{# Tablet / Desktop #}
{% set pages = pagination.paginationData %}
<ul class="hidden gap-2 md:flex">
{% include 'component/pagination_page.html.twig' with {
page: pages.first ?? null,
label: 'pagination.first'|trans,
disabled: pages.first is not defined
} %}
{% include 'component/pagination_page.html.twig' with {
page: pages.previous ?? null,
label: 'pagination.previous'|trans,
disabled: pages.previous is not defined
} %}
{% for page in pages.pagesInRange %}
{% include 'component/pagination_page.html.twig' with {
page: page,
label: page,
current: page == pages.current
} %}
{% endfor %}
{% include 'component/pagination_page.html.twig' with {
page: pages.next ?? null,
label: 'pagination.next'|trans,
disabled: pages.next is not defined
} %}
{% include 'component/pagination_page.html.twig' with {
page: pages.last ?? null,
label: 'pagination.last'|trans,
disabled: pages.last is not defined
} %}
</ul>
{# Mobile #}
<form class="flex justify-end w-full" action="" method="get">
<script>
var target = new URL('{{ url(app.request.get('_route'), app.request.query.all) | raw }}');
function onSelectChange(event) {
event.preventDefault();
target.searchParams.set('page', event.target.value);
window.location.href = target;
}
</script>
<select onchange="onSelectChange(event)"
class="w-full text-center md:hidden form-control">
{% for page in 1..pages.pageCount %}
<option value="{{ page }}" {{ pages.current == page ? 'selected' }}>
{{ page }}
</option>
{% endfor %}
</select>
</form>