{% load i18n navigation  %}
<nav aria-label="{% trans 'Постраничная навигация' %}">
    <ul class="pagination pagination-sm justify-content-end">
        <li class="mr-1">
            <div class="dropdown">
            {% with 'dropdown'|guid as id %}
            {% with page.paginator.per_page|stringformat:'d' as per_page %}
                <button class="btn btn-secondary btn-sm" type="button" id="{{ id }}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                    <span>{{ per_page }} {% trans 'на страницу' %}</span>
                </button>
                <div class="dropdown-menu dropdown-menu-right" aria-labelledby="{{ id }}">
                {% for v in '5,10,15,25,50,100,250,500'|split %}
                    <a class="dropdown-item{% if per_page == v %} active{% endif %}" href="{% addparams request l=v %}">{{ v }}</a>
                {% endfor %}
                </div>
            {% endwith %}
            {% endwith %}
            </div>
        </li>
{% for p in page|make_page_range %}
    {% if p == page.number %}
        <li class="page-item active"><a class="page-link text-light bg-dark" href="{% addparams request p=p %}">{{ p }}</a></li>
    {% elif p == '.' %}
        <li class="page-item disabled"><a class="page-link" href="#">...</a></li>
    {% else %}
        <li class="page-item"><a class="page-link text-muted" href="{% addparams request p=p %}">{{ p }}</a></li>
    {% endif %}
{% endfor %}
    </ul>
</nav>
