{#/** * @file * Bootstrap 5 Pagination with Lucide Icons * * View that can be used with the KnpPaginator bundle * https://getbootstrap.com/docs/5.3/components/pagination/ * */#}{% if pageCount > 1 %} <nav aria-label="Page navigation"> {% set classAlign = (align is not defined) ? '' : align=='center' ? ' justify-content-center' : (align=='right' ? ' justify-content-end' : '') %} {% set classSize = (size is not defined) ? ' pagination-sm' : size=='large' ? ' pagination-lg' : (size=='small' ? ' pagination-sm' : '') %} <ul class="pagination{{ classAlign }}{{ classSize }} mb-0"> {# First Page #} {% if first is defined and current > 2 %} <li class="page-item"> <a href="{{ path(route, query|merge({(pageParameterName): first})) }}" class="page-link" aria-label="First" data-bs-toggle="tooltip" title="First page"> <i data-lucide="chevrons-left" style="width: 14px; height: 14px;"></i> </a> </li> {% endif %} {# Previous Page #} {% if previous is defined %} <li class="page-item"> <a href="{{ path(route, query|merge({(pageParameterName): previous})) }}" class="page-link" aria-label="Previous"> <i data-lucide="chevron-left" style="width: 14px; height: 14px;"></i> </a> </li> {% else %} <li class="page-item disabled"> <span class="page-link" aria-label="Previous"> <i data-lucide="chevron-left" style="width: 14px; height: 14px;"></i> </span> </li> {% endif %} {# Page Numbers #} {% if startPage > 1 %} <li class="page-item"> <a class="page-link" href="{{ path(route, query|merge({(pageParameterName): 1})) }}">1</a> </li> {% if startPage > 2 %} <li class="page-item disabled"> <span class="page-link">…</span> </li> {% endif %} {% endif %} {% for page in pagesInRange %} {% if page != current %} <li class="page-item"> <a class="page-link" href="{{ path(route, query|merge({(pageParameterName): page})) }}">{{ page }}</a> </li> {% else %} <li class="page-item active" aria-current="page"> <span class="page-link">{{ page }}</span> </li> {% endif %} {% endfor %} {% if endPage < pageCount %} {% if endPage < pageCount - 1 %} <li class="page-item disabled"> <span class="page-link">…</span> </li> {% endif %} <li class="page-item"> <a class="page-link" href="{{ path(route, query|merge({(pageParameterName): pageCount})) }}">{{ pageCount }}</a> </li> {% endif %} {# Next Page #} {% if next is defined %} <li class="page-item"> <a class="page-link" rel="next" href="{{ path(route, query|merge({(pageParameterName): next})) }}" aria-label="Next"> <i data-lucide="chevron-right" style="width: 14px; height: 14px;"></i> </a> </li> {% else %} <li class="page-item disabled"> <span class="page-link" aria-label="Next"> <i data-lucide="chevron-right" style="width: 14px; height: 14px;"></i> </span> </li> {% endif %} {# Last Page #} {% if last is defined and current < pageCount - 1 %} <li class="page-item"> <a href="{{ path(route, query|merge({(pageParameterName): last})) }}" class="page-link" aria-label="Last" data-bs-toggle="tooltip" title="Last page"> <i data-lucide="chevrons-right" style="width: 14px; height: 14px;"></i> </a> </li> {% endif %} </ul> </nav> {# Re-initialize Lucide icons for pagination #} <script> if (typeof lucide !== 'undefined') { lucide.createIcons(); } </script>{% endif %}