{% load override_query_parameters %}
{% if paginator.count %}
<nav aria-label="pagination">
    <ul class="pagination">
        {% for page_number in elided_page_range %}
            {% if page_number == page_obj.number %}
                <li class="page-item active" aria-current="page">
                    <span class="page-link">{{ page_number }}</span>
                </li>
            {% elif page_number == page_obj.paginator.ELLIPSIS %}
                <li class="page-item">
                    <span class="page-link">{{ page_number }}</span>
                </li>
            {% else %}
                <li class="page-item">
                    <a class="page-link" href="?{% override_query_parameters page=page_number %}">{{ page_number }}</a>
                </li>
            {% endif %}
        {% endfor %}
    </ul>
</nav>
{% endif %}
