<% if results.total_pages > 1 %>
  <nav class="text-center" aria-label="Pagination">
    <ul class="pagination">
      <% if results.current_page.to_i != 1 %>
      <li class="page-item">
        <a class="page-link" href="?<%= pagination_params(results.current_page.to_i - 1) %>" aria-label="Previous">
          <span aria-hidden="true">&laquo;</span>
        </a>
      </li>
      <% end %>
      <% for n in results.pages%>
      <li class="page-item <%= "active" if results.current_page.to_i == n %>">
        <% if n %>
          <a class="page-link" href="?<%= pagination_params(n) %>"><%= n %></a>
        <% else %>
          <a>…</a>
        <% end %>
      </li>
      <% end %>
      <% if results.current_page.to_i != results.total_pages %>
      <li class="page-item">
        <a class="page-link" href="?<%= pagination_params(results.current_page.to_i + 1) %>" aria-label="Next">
          <span aria-hidden="true">&raquo;</span>
        </a>
      </li>
      <% end %>
    </ul>
  </nav>
<% end %>
