{#
/**
 * @file
 * UIkit 3.0 pagination control implementation.
 *
 * View that can be used with the pagination module
 * from the UIKit Toolkit
 * https://getuikit.com/docs/pagination
 *
 *
 * @author KULDIP PIPALIYA <kuldipem@gmail.com>
 */
#}
{% if pageCount > 1 %}
    <ul class="uk-pagination uk-flex-center uk-margin-medium-top">
        {% if previous is defined %}
            <li>
                <a rel="prev" href="{{ path(route, knp_pagination_query(query, previous, options)) }}">&laquo;&nbsp;{{ 'label_previous'|trans({}, 'KnpPaginatorBundle') }}</a>
            </li>
        {% else %}
            <li class="uk-disabled">
                <span>&laquo;&nbsp;{{ 'label_previous'|trans({}, 'KnpPaginatorBundle') }}</span>
            </li>
        {% endif %}

        {% if startPage > 1 %}
            <li>
                <a href="{{ path(route, knp_pagination_query(query, 1, options)) }}">1</a>
            </li>
            {% if startPage == 3 %}
                <li>
                    <a href="{{ path(route, knp_pagination_query(query, 2, options)) }}">2</a>
                </li>
            {% elseif startPage != 2 %}
                <li class="uk-disabled">
                    <span>&hellip;</span>
                </li>
            {% endif %}
        {% endif %}

        {% for page in pagesInRange %}
            {% if page != current %}
                <li>
                    <a href="{{ path(route, knp_pagination_query(query, page, options)) }}">{{ page }}</a>
                </li>
            {% else %}
                <li class="uk-active">
                    <span>{{ page }}</span>
                </li>
            {% endif %}

        {% endfor %}

        {% if pageCount > endPage %}
            {% if pageCount > (endPage + 1) %}
                {% if pageCount > (endPage + 2) %}
                    <li class="uk-disabled">
                        <span>&hellip;</span>
                    </li>
                {% else %}
                    <li>
                        <a href="{{ path(route, knp_pagination_query(query, (pageCount - 1), options)) }}">{{ pageCount - 1 }}</a>
                    </li>
                {% endif %}
            {% endif %}
            <li>
                <a href="{{ path(route, knp_pagination_query(query, pageCount, options)) }}">{{ pageCount }}</a>
            </li>
        {% endif %}

        {% if next is defined %}
            <li>
                <a rel="next" href="{{ path(route, knp_pagination_query(query, next, options)) }}">{{ 'label_next'|trans({}, 'KnpPaginatorBundle') }}&nbsp;&raquo;</a>
            </li>
        {% else %}
            <li class="uk-disabled">
                <span>{{ 'label_next'|trans({}, 'KnpPaginatorBundle') }}&nbsp;&raquo;</span>
            </li>
        {% endif %}
    </ul>
{% endif %}
