{% load karvi_style %}

{% if is_paginated %}
  <ul class="pagination mt-3">
    {% if page_obj.has_previous %}
      <li class="page-item">
        <a class="page-link" href="?{% pagination_pagelink page_obj.previous_page_number %}">&laquo;</a>
      </li>
    {% else %}
      <li class="page-item disabled"><span class="page-link">&laquo;</span></li>
    {% endif %}
    {% for i in paginator.page_range %}
      {% if page_obj.number == i %}
        <li class="page-item active"><span class="page-link">{{ i }} <span class="sr-only">(current)</span></span></li>
      {% else %}
        <li class="page-item">
          <a class="page-link" href="?{% pagination_pagelink i %}">{{ i }}</a>
        </li>
      {% endif %}
    {% endfor %}
    {% if page_obj.has_next %}
      <li class="page-item">
        <a class="page-link" href="?{% pagination_pagelink page_obj.next_page_number %}">&raquo;</a>
      </li>
    {% else %}
      <li class="page-item disabled"><span class="page-link">&raquo;</span></li>
    {% endif %}
  </ul>
{% endif %}
