<nav class="text-center" aria-label="Page navigation">
    <ul class="pagination">
        {% if pages|first > 0 %}
        <li class="page-item"><a class="page-link" href="./?p={{ pages|first }}"><i class="fa fa-angle-double-left"></i></a></li>
        {% endif %}
        {% for page in pages %}
            {% if page > 0 and page <= last_page %}
            <li class="page-item{% if current_page == page %} active{% endif %}"><a class="page-link" href="./?p={{ page }}">{{ page }}</a></li>
            {% endif %}
        {% endfor %}

        {% if pages|last <= last_page %}
        <li class="page-item"><a class="page-link" href="./?p={{ pages|last }}"><i class="fa fa-angle-double-right"></i></a></li>
        {% endif %}
    </ul>
</nav>
