<ul class="pagination">
    {% if p == 1 %}
    <li class="disabled"><a href="#">&larr;  Previous</a></li>
    {% else %}
    <li><a href="./?c={{category}}&s={{sort}}&p={{p|add:-1}}">&larr;  Previous </a></li>
    {% endif %}

    {% for i in prev_pages %}
    <li class=""><a href="./?c={{category}}&s={{sort}}&p={{i}}"> {{i}} </a></li>
    {% endfor %}

    <li class="active"><a href="./?c={{category}}&s={{sort}}&p={{g.p}}"> {{p}} <span class="sr-only">(current)</span></a></li>
    
    {% for i in next_pages %}
    <li class=""><a href="./?c={{category}}&s={{sort}}&p={{i}}"> {{i}} </a></li>
    {% endfor %}

    {% if p >= page_max %}
    <li class="disabled"><a href="#"> Next &rarr;</a></li>
    {% else %}
    <li><a href="./?c={{category}}&s={{sort}}&p={{p|add:1}}"> Next &rarr; </a></li>
    {% endif %}
</ul>
