{% from "_custom_select.html" import custom_select %} {# Minimal bar: LEFT total count | MIDDLE pager (same control pattern as Commit History modal) | RIGHT per-page picker. Always shown. #} {% macro render_pagination(current_page, total_pages, limit, endpoint, extra_params={}, total_count=none, item_noun='items') %} {% set is_unlimited = (limit is none) or (limit == 'unlimited') %} {% set lim_q = 'unlimited' if is_unlimited else limit %} {% set eff_pages = total_pages if total_pages > 0 else 1 %} {% set pagination_options = [ {"value": url_for(endpoint, page=1, limit='5', **extra_params), "label": "5"}, {"value": url_for(endpoint, page=1, limit='10', **extra_params), "label": "10"}, {"value": url_for(endpoint, page=1, limit='25', **extra_params), "label": "25"}, {"value": url_for(endpoint, page=1, limit='50', **extra_params), "label": "50"}, {"value": url_for(endpoint, page=1, limit='unlimited', **extra_params), "label": "All"} ] %} {% set _limit = 'unlimited' if is_unlimited else (limit|string) %} {% set pagination_selected_url = url_for(endpoint, page=1, limit=_limit, **extra_params) %} {% set pagination_selected_label = "All" if is_unlimited else (limit|string) %}
{% endmacro %}