{#
This file is part of EC-CUBE

Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.

http://www.ec-cube.co.jp/

For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
#}
{% if pages.pageCount > 1 %}
    <ul class="pagination">

        <!-- 最初へ -->
        {% if pages.firstPageInRange != 1 %}
            <li class="page-item">
                {# FIXME: Need check pass routes before use default _route from request #}
                <a class="page-link" href="{{ path(
                    routes ? routes : app.request.attributes.get('_route'),
                    app.request.query.all|merge({'page_no': pages.first})) }}">{{ 'admin.common.first'|trans }}</a></li>

        {% endif %}

        <!-- 前へ -->
        {% if pages.previous is defined %}
            <li class="page-item">
                {# FIXME: Need check pass routes before use default _route from request #}
                <a class="page-link"
                   href="{{ path(routes ? routes : app.request.attributes.get('_route'), app.request.query.all|merge({'page_no': pages.previous})) }}">{{ 'admin.common.prev'|trans }}</a>
            </li>
        {% endif %}

        <!-- 1ページリンクが表示されない場合、「...」を表示 -->
        {% if pages.firstPageInRange != 1 %}
            <li class="page-item">...</li>
        {% endif %}

        {% for page in pages.pagesInRange %}
            <li class="page-item{% if page == pages.current %} active{% endif %}">
                {# FIXME: Need check pass routes before use default _route from request #}
                <a class="page-link"
                   href="{{ path(routes ? routes : app.request.attributes.get('_route'),app.request.query.all|merge({'page_no': page})) }}">
                    {{ page }}
                </a>
            </li>
        {% endfor %}

        <!-- 最終ページリンクが表示されない場合、「...」を表示 -->
        {% if pages.last != pages.lastPageInRange %}
            <li class="page-item">...</li>
        {% endif %}

        <!-- 次へ -->
        {% if pages.next is defined %}
            <li class="page-item">
                {# FIXME: Need check pass routes before use default _route from request #}
                <a class="page-link"
                   href="{{ path(routes ? routes : app.request.attributes.get('_route'),app.request.query.all|merge({'page_no': pages.next})) }}">{{ 'admin.common.next'|trans }}</a>
            </li>
        {% endif %}

        <!-- 最後へ -->
        {% if pages.last != pages.lastPageInRange %}
            <li class="page-item">
                {# FIXME: Need check pass routes before use default _route from request #}
                <a class="page-link" href="{{ path(
                    routes ? routes : app.request.attributes.get('_route'),
                    app.request.query.all|merge({'page_no': pages.last})) }}">{{ 'admin.common.last'|trans }}</a></li>
        {% endif %}

    </ul>
{% endif %}
