{% macro render_pagination(pagination, endpoint) %}

  <ul class="pagination">

    {% if pagination.has_prev %}
      <li>
        <a href="{{endpoint}}/{{pagination.prev_num}}" aria-label="Previous">
          <span aria-hidden="true">&laquo;</span>
        </a>
      </li>
    {% endif %}

    {% for p in pagination.iter_pages(left_edge=1, left_current=2, right_current=3, right_edge=1) %}
      {% if p %}
        {% if p != pagination.page %}
          <li>
            <a href="{{endpoint}}/{{p}}">{{ p }}</a>
          </li>
        {% else %}
          <li class="active">
            <a href="{{endpoint}}/{{p}}">{{ p }}</a>
          </li>
        {% endif %}
      {% else %}
        <li class="disabled">
          <span class="ellipsis">&hellip;</span>
        </li>
      {% endif %}
    {% endfor %}

    {% if pagination.has_next %}
      <li>
        <a href="{{endpoint}}/{{pagination.next_num}}" aria-label="Next">
          <span aria-hidden="true">&raquo;</span>
        </a>
      </li>
    {% endif %}

  </ul>

{% endmacro %}
