{% if is_paginated %}
{% load i18n %}
<nav aria-label="{% trans 'Pagination' %}" class="mt-4">
  <ul class="pagination justify-content-center">
    {% if page_obj.has_previous %}
      <li class="page-item">
        <a href="?page={{ page_obj.previous_page_number }}{{ getvars }}{{ hashtag }}" class="page-link">
          {% trans "previous" %}
        </a>
      </li>
    {% else %}
      <li class="page-item disabled">
        <span class="page-link">
          {% trans "previous" %}
        </span>
      </li>
    {% endif %}

      {% for page in pages %}
      {% if page %}
      {% if page == page_obj.number %}
    <li class="page-item active">
      <span class="page-link">
        {{ page }}
      </span>
    </li>
    {% else %}
    <li class="page-item">
      <a href="?page={{ page }}{{ getvars }}{{ hashtag }}" class="page-link">
        {{ page }}
        </a>
    </li>
    {% endif %}
    {% endif %}
    {% endfor %}

    {% if page_obj.has_next %}
      <li class="page-item">
        <a href="?page={{ page_obj.next_page_number }}{{ getvars }}{{ hashtag }}" class="page-link">
          {% trans "next" %}
        </a>
      </li>
    {% else %}
      <li class="page-item disabled">
        <span class="page-link">
          {% trans "next" %}
        </span>
      </li>
    {% endif %}
  </ul>
</nav>

{% endif %}
