{# Pagination + result count. Expects: page, page_size, total, has_prev, has_next in scope. Inherits all current query params from request.args, only overriding `page` so filters/search/page_size are preserved. The caller may set `extra_class` via `{% with %}` to tweak vertical spacing. #} {% if total and total > 0 %} {% set start = (page - 1) * page_size + 1 %} {% set end = [page * page_size, total] | min %} {% set pagination_args = request.args.to_dict(flat=False) %} {% set _ = pagination_args.pop('page', None) %} {% endif %}