{% endif %}
{% for i in products.paginator.page_range %}
{# if we're beyond the first five pages, just show "..." until three pages before the current page #}
{# e.g. on page 12 show: "... 9 10 11 12" #}
{% if products.number > 5 and i < products.number|subtract:4 %}
{% if i|subtract:3 <= 0 %}
{# if we're before the last five pages, just show "..." for pages more than three after the current page #}
{# e.g. on page 1 of 10 show: "1 2 3 4 ..." #}
{% elif products.number < products.paginator.num_pages|subtract:5 and i > products.number|add:4 %}
{% if i|add:3 > products.paginator.num_pages %}