{% load wagtailcore_tags %}

{% if events.has_other_pages %}
  <ul class="events-pagination">
    {% if events.has_previous %}
      <li><a href="?page={{ events.previous_page_number }}">&laquo;</a></li>
    {% else %}
      <li class="disabled"><span>&laquo;</span></li>
    {% endif %}
    {% for i in events.paginator.page_range %}
      {% if events.number == i %}
        <li class="active"><span>{{ i }}</span></li>
      {% else %}
        <li><a href="?page={{ i }}">{{ i }}</a></li>
      {% endif %}
    {% endfor %}
    {% if events.has_next %}
      <li><a href="?page={{ events.next_page_number }}">&raquo;</a></li>
    {% else %}
      <li class="disabled"><span>&raquo;</span></li>
    {% endif %}
  </ul>
{% endif %}
