
    <!--    previous page-->
    {% if page_obj.has_previous %}
        <a class="btn btn-outline-primary mb-4" href="?page=1{% for k, v in request.GET.items %}{% if k != 'page' %}&{{ k }}={{ v }}{% endif %}{% endfor %}">First</a>
        <a class="btn btn-outline-primary mb-4" href="?page={{page_obj.previous_page_number}}{% for k, v in request.GET.items %}{% if k != 'page' %}&{{ k }}={{ v }}{% endif %}{% endfor %}">Previous</a>
    {% endif %}

    <!--    Additional pages-->
    {% for num in page_obj.paginator.page_range %}
        {% if page_obj.number == num %}
            <a class="btn btn-primary mb-4" href="?page={{ num }} {% for k, v in request.GET.items %}{% if k != 'page' %}&{{ k }}={{ v }}{% endif %}{% endfor %}">{{ num }}</a>
        {% elif num > page_obj.number|add:'-3' and num < page_obj.number|add:'3' %}
            <a class="btn btn-outline-primary mb-4" href="?page={{ num }}{% for k, v in request.GET.items %}{% if k != 'page' %}&{{ k }}={{ v }}{% endif %}{% endfor %}">{{ num }}</a>
        {% endif %}
    {% endfor %}

    <!--    next page-->
    {% if page_obj.has_next %}
        <a class="btn btn-outline-primary mb-4" href="?page={{page_obj.next_page_number}}{% for k, v in request.GET.items %}{% if k != 'page' %}&{{ k }}={{ v }}{% endif %}{% endfor %}">Next</a>
        <a class="btn btn-outline-primary mb-4" href="?page={{page_obj.paginator.num_pages}}{% for k, v in request.GET.items %}{% if k != 'page' %}&{{ k }}={{ v }}{% endif %}{% endfor %}">Last</a>
    {% endif %}
