{% if context.pageNumber > 1 %}
<ul class="pagination" data-page-number="{{ context.pageNumber }}">
{# Preview Button #}
{% if context.page > 1 %}
{% set previewParams = params|merge({'page': (context.page - 1)}) %}
<li class="arrow"><a href="{{ path(route, previewParams) }}">«</a></li>
{% endif %}
{# Middle #}
{% for i in 1..context.pageNumber %}
{% set params = params|merge({'page': i}) %}
{% if context.page == i %}
<li><a href="#" class="current">{{ i }}</a></li>
{% else %}
<li><a href="{{ path(route, params) }}" data-page="{{ i }}">{{ i }}</a></li>
{% endif %}
{% endfor %}
{# Next Button #}
{% if context.page < context.pageNumber %}
{% set nextParams = params|merge({'page': (context.page + 1)}) %}
<li class="arrow"><a href="{{ path(route, nextParams) }}">»</a></li>
{% endif %}
</ul>
{% endif %}
|