{% load i18n %}
{% comment %}
Server-paging navigation shared by every paginated list/detail view.

``page_obj``        — the Django ``Page`` for the current request.
``pagination_query`` — a dict of the active filter params; each truthy
                       entry is appended to the prev/next links so the
                       filter survives a page step. Iterating a
                       precomputed dict (not branching per filter) is
                       what keeps a new filter from needing a new ``if``
                       in every list template.

Self-guards on ``has_other_pages`` so a caller can include it
unconditionally.
{% endcomment %}
{% if page_obj.has_other_pages %}
    <nav aria-label="{% translate 'pagination' %}">
        <ul class="pagination">
            {% if page_obj.has_previous %}
                <li class="page-item">
                    <a class="page-link"
                       aria-label="{% translate 'Previous page' %}"
                       href="?page={{ page_obj.previous_page_number }}{% for key, value in pagination_query.items %}{% if value %}&{{ key }}={{ value }}{% endif %}{% endfor %}"><span aria-hidden="true">&laquo;</span></a>
                </li>
            {% endif %}
            <li class="page-item active" aria-current="page">
                <span class="page-link">{{ page_obj.number }} / {{ page_obj.paginator.num_pages }}</span>
            </li>
            {% if page_obj.has_next %}
                <li class="page-item">
                    <a class="page-link"
                       aria-label="{% translate 'Next page' %}"
                       href="?page={{ page_obj.next_page_number }}{% for key, value in pagination_query.items %}{% if value %}&{{ key }}={{ value }}{% endif %}{% endfor %}"><span aria-hidden="true">&raquo;</span></a>
                </li>
            {% endif %}
        </ul>
    </nav>
{% endif %}
