{% load i18n %}
{% load bootstrap_pagination %}
<ul class="pagination{% if size == "small" %} pagination-sm{% endif %}{% if size == "large" %} pagination-lg{% endif %} {{ extra_pagination_classes }}">
{% if show_first_last %}
    {% if not page.has_previous %}
      <li class="page-item disabled">
        <span class="page-link" aria-hidden="true" title="{% trans 'First Page' %}">{{ first_label }}</span>
      </li>
    {% else %}
      <li class="page-item">
        <a class="page-link" aria-label="{% trans 'First Page' %}" title="{% trans  'First Page' %}" href="{{ first_page_url|default:"#"|escape }}"><span aria-hidden="true">{{first_label}}</span></a>
      </li>
    {% endif %}
{% endif %}
{% if show_prev_next %}
    {% if not page.has_previous %}
      <li class="page-item disabled">
        <span class="page-link" aria-hidden="true" title="{%  trans 'Previous Page'  %}">{{ previous_label }}</span>
      </li>
    {% else %}
      <li class="page-item">
        <a class="page-link" aria-label="{% trans 'Previous Page' %}" title="{% trans 'Previous Page' %}" href="{{ previous_page_url|default:"#"|escape }}"><span aria-hidden="true">{{ previous_label }}</span></a>
      </li>
    {% endif %}
{% endif %}
{% for pagenum, index_range, url in page_urls %}
    {% if page.number == pagenum %}
        <li class="page-item active">
          <span class="page-link" aria-label="{% trans 'Current Page' %}" title="{% trans 'Current Page' %}">{% if show_index_range %} {{ index_range }} {% else %} {{ pagenum }} {% endif %}</span>
        </li>
    {% else %}
        <li class="page-item">
          <a class="page-link" aria-label="{% trans 'Page' %} {{ pagenum }} {% trans 'of' %} {{ page.paginator.num_pages }}" title="{% trans 'Page' %} {{ pagenum }} {% trans 'of' %} {{ page.paginator.num_pages }}" href="{{ url|escape }}">{% if show_index_range %} {{ index_range }} {% else %} {{ pagenum }} {% endif %}</a>
        </li>
    {% endif %}
{% endfor %}
{% if show_prev_next %}
    {% if not page.has_next %}
      <li class="page-item  disabled">
        <span class="page-link" aria-hidden="true" title="{% trans 'Next Page' %}">{{ next_label }}</span>
      </li>
    {% else %}
      <li class="page-item">
        <a class="page-link"  aria-label="{% trans 'Next Page' %}" title="{% trans 'Next Page' %}" href="{{ next_page_url|default:"#"|escape }}"><span aria-hidden="true">{{ next_label }}</span></a>
      </li>
    {% endif %}
{% endif %}
{% if show_first_last %}
    {% if not page.has_next %}
      <li class="page-item disabled">
        <span class="page-link" aria-hidden="true" title="{% trans 'Last Page' %}" >{{ last_label }}</span>
      </li>
    {% else %}
      <li class="page-item">
        <a class="page-link" aria-label="{% trans 'Last Page' %}" title="{% trans 'Last Page' %}" href="{{ last_page_url|default:"#"|escape }}"><span aria-hidden="true">{{last_label}}</span></a>
      </li>
    {% endif %}
{% endif %}
</ul>
