<nav class="pagination" role="navigation"> {% set args = dict(request.args) %} {% do args.update(request.view_args) %} {% if first %} <a class="pagination-previous" disabled>«</a> {% else %} {% do args.update([('page_bound', page_bound_before), ('page_after', 0)]) %} <a class="pagination-previous" href="{{ url_for(request.endpoint, **args) }}" aria-label="Previous"> « </a> {% endif %} {% if last %} <a class="pagination-next" disabled>»</a> {% else %} {% do args.update([('page_bound', page_bound_after), ('page_after', 1)]) %} <a class="pagination-next" href="{{ url_for(request.endpoint, **args) }}" aria-label="Next"> » </a> {% endif %} </nav>