{% load static %}
<div class="blog-pagination">
    <ul class="justify-content-center">

        {% if page_obj.has_previous %}
            <li><a href="?page={{ page_obj.previous_page_number }}"> << </a></li>
        {% else %}

        {% endif %}

        {% if page_obj.number|add:'-2' > 1 %}
            <li><a href="?page={{ page_obj.number|add:'-3' }}">&hellip;</a></li>
        {% endif %}

        {% for i in page_obj.paginator.page_range %}
            {% if page_obj.number == i %}
                <li class="active"><span>{{ i }}</span></li>
            {% elif i > page_obj.number|add:'-3' and i < page_obj.number|add:'3' %}
                <li><a href="?page={{ i }}">{{ i }}</a></li>
            {% endif %}
        {% endfor %}

        {% if page_obj.paginator.num_pages > page_obj.number|add:'2' %}
            <li><a href="?page={{ page_obj.number|add:'3' }}">&hellip;</a></li>
        {% endif %}

        {% if page_obj.has_next %}
            <li><a href="?page={{ page_obj.next_page_number }}"> >> </a></li>
        {% else %}

        {% endif %}

  </ul>
</div>