<ul class="pagination">
    {% if page.has_previous %}
        {% if 1 not in page_range %}
            <li><a href="?{{ querystring }}{% if querystring %}&amp;{% endif %}{{ param }}=1" title="First Page"><i class="fa fa-angle-double-left"></i></a></li>
        {% endif %}
        <li><a href="?{{ querystring }}{% if querystring %}&amp;{% endif %}{{ param }}={{ page.previous_page_number }}" title="Previous Page"><i class="fa fa-angle-left"></i></a></li>
    {% endif %}
    {% for p in page_range %}
        <li{% if p == page.number %} class="active"{% endif %}><a href="?{{ querystring }}{% if querystring %}&amp;{% endif %}{{ param }}={{ p }}">{{ p }}</a></li>
    {% endfor %}
    {% if page.has_next %}
        <li><a href="?{{ querystring }}{% if querystring %}&amp;{% endif %}{{ param }}={{ page.next_page_number }}" title="Next Page"><i class="fa fa-angle-right"></i></a></li>
        {% if paginator.num_pages not in page_range %}
            <li><a href="?{{ querystring }}{% if querystring %}&amp;{% endif %}{{ param }}={{ paginator.num_pages }}" title="Last Page"><i class="fa fa-angle-double-right"></i></a></li>
        {% endif %}
    {% endif %}
</ul>
