{# Coffee House Pagination Component. Usage: {% with current_page=3, total_pages=10, base_url="/admin/users" %} {% include "components/pagination.html" %} {% endwith %} Renders DaisyUI join pagination with prev/next and page numbers. Preserves existing query string params (appends/replaces ?page=N). #} {% if total_pages is defined and total_pages > 1 %}
{# Previous #} {% if current_page > 1 %} Previous {% else %} {% endif %} {# Page numbers — show max 7 pages with ellipsis #} {% set start_page = [1, current_page - 2] | max %} {% set end_page = [total_pages, current_page + 2] | min %} {% if start_page > 1 %} 1 {% if start_page > 2 %} {% endif %} {% endif %} {% for p in range(start_page, end_page + 1) %} {{ p }} {% endfor %} {% if end_page < total_pages %} {% if end_page < total_pages - 1 %} {% endif %} {{ total_pages }} {% endif %} {# Next #} {% if current_page < total_pages %} Next {% else %} {% endif %}
{% endif %}