{# Tabler-style pagination. Expects: current_page, pagecount, has_prev, has_next, prev_url, next_url; optional: total_pages, page_links (list of (page_num, url) for numbered links). #}
<nav aria-label="Pagination" class="d-flex justify-content-between align-items-center mt-3">
  <div class="text-secondary small">
    Page {{ current_page }}{% if total_pages is defined and total_pages is not none %} of {{ total_pages }}{% endif %}
    <span class="ms-2">({{ pagecount }} per page)</span>
  </div>
  <ul class="pagination mb-0">
    <li class="page-item{% if not has_prev %} disabled{% endif %}">
      {% if has_prev %}
      <a class="page-link" href="{{ prev_url }}" aria-label="Previous">
        <span aria-hidden="true">&laquo;</span>
      </a>
      {% else %}
      <span class="page-link" aria-label="Previous" aria-disabled="true">
        <span aria-hidden="true">&laquo;</span>
      </span>
      {% endif %}
    </li>
    {% if page_links is defined and page_links %}
      {% for p, u in page_links %}
    <li class="page-item{% if p == current_page %} active{% endif %}{% if not u %} disabled{% endif %}">
      {% if u %}
      <a class="page-link" href="{{ u }}">{{ p }}</a>
      {% else %}
      <span class="page-link">&hellip;</span>
      {% endif %}
    </li>
      {% endfor %}
    {% else %}
    <li class="page-item active"><span class="page-link">{{ current_page }}</span></li>
    {% endif %}
    <li class="page-item{% if not has_next %} disabled{% endif %}">
      {% if has_next %}
      <a class="page-link" href="{{ next_url }}" aria-label="Next">
        <span aria-hidden="true">&raquo;</span>
      </a>
      {% else %}
      <span class="page-link" aria-label="Next" aria-disabled="true">
        <span aria-hidden="true">&raquo;</span>
      </span>
      {% endif %}
    </li>
  </ul>
</nav>