{%- set ns.prev = getstart - getshow -%}
{%- if ns.prev == 0 -%}
{%- set ns.prev = None -%}
{%- endif -%}
{%- set ns.next = getstart + getshow -%}
{%- if ns.next == 0 -%}
{%- set ns.next = None -%}
{%- endif -%}
{%- set thispage = (getstart / getshow)|round(0,'floor')|int + 1 -%}
{%- set totalpages = (ns.total / getshow)|round(0,'ceil')|int -%}
{%- set ns.ellipsis = False -%}
{% if thispage > 1 %}
« First
{% if (getstart - getshow) > 1 %}
‹ Prev
{% endif %}
{% endif %}
{% for page in range(1, totalpages+1) %}
{% if page < 4 or page > (totalpages+1-4) or (page > (thispage-3) and page < (thispage+3)) %}
{%- if page != thispage -%}
{% set goto = (page - 1) * getshow %}
{%- if goto == 0 -%}
{%- set goto = None -%}
{%- endif -%}
{{ page }}
{%- else -%}
{{ page }}
{%- endif %}
{%- set ns.ellipsis = False -%}
{%- else -%}
{%- if not ns.ellipsis -%}
…
{%- endif -%}
{%- set ns.ellipsis = True -%}
{% endif %}
{% endfor %}
{% if thispage < totalpages %}
{% if (getstart + getshow) != (totalpages - 1) * getshow %}
Next ›
{% endif %}
Last »
{% endif %}