{% set pages = admin_list.getPageNumbers() %}
{% set current_page = admin_list.getCurrentPage() %}
{% set base_params = base_params is defined ? base_params : admin_list.getParams() %}
{% set order_direction = admin_list.getOrderDir() %}
{% set order_field = admin_list.getOrderField() %}

{% if route is not defined %}{% set route = app.request.attributes.get('_route') %}{% endif %}
{% if class is not defined %}{% set class = 'pagination small' %}{% endif %}

{% block content %}
    {% if pages|length > 1 %}
        <ul class="{{class}}">
            {% for page in pages %}
                <li class="{% if current_page == page %}active{% endif %}">
                    <a href="{{ path(route, base_params|merge({ page: page, orderDir : order_direction, orderBy : order_field }) ) }}">
                        {% if loop.first and page > 0 %}&hellip;{% endif %}{{ page+1 }}{% if loop.last %}&hellip;{% endif %}
                    </a>
                </li>
            {% endfor %}
        </ul>
    {% endif %}
{% endblock %}
