<!DOCTYPE html>
<html
        xmlns:th="http://www.thymeleaf.org"
        xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
        xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
        layout:decorate="~{layout/default_layout}">
<th:block layout:fragment="head">
</th:block>
<th:block layout:fragment="content" id="content">
  <div id="main_layer">
    <div class="layer">
      <th:block th:each="location : ${locationPage.content}">
        <div class="location-item"> <div class="location-header">
          <span class="location-time" th:text="${location.displayTime}"></span>
          <span class="location-between" th:text="${location.bettween}"></span>
        </div>
          <div class="location-body">
            <p class="location-address" th:text="${location.mAddressLines}"></p>
            <p class="location-coords">
              <span>위도: <b th:text="${#numbers.formatDecimal(location.mLatitude, 1, 3)}"></b></span>
              <span>경도: <b th:text="${#numbers.formatDecimal(location.mLongitude, 1, 3)}"></b></span>
              <span class="location-country" th:text="${'(' + location.mCountryName + ')'}"></span>
            </p>
          </div>
        </div>
      </th:block>
    </div>

    <div class="pagination">
      <th:block th:with="currentPage=${locationPage.number},
                           totalPages=${locationPage.totalPages}">

        <a class="nav-link" th:if="${currentPage > 0}" th:href="@{/bums/where.bs(page=0)}">&lt;&lt; 처음</a>
        <span class="nav-link disabled" th:unless="${currentPage > 0}">&lt;&lt; 처음</span>

        <a class="nav-link" th:if="${locationPage.hasPrevious()}" th:href="@{/bums/where.bs(page=${currentPage - 1})}">&lt; 이전</a>
        <span class="nav-link disabled" th:unless="${locationPage.hasPrevious()}">&lt; 이전</span>

        <th:block th:with="startPage=${T(java.lang.Math).max(0, currentPage - 3)},
                             endPage=${T(java.lang.Math).min(totalPages - 1, currentPage + 3)}">

          <th:block th:each="pageNum : ${#numbers.sequence(startPage, endPage)}">
            <a class="page-num"
               th:if="${pageNum != currentPage}"
               th:href="@{/bums/where.bs(page=${pageNum})}"
               th:text="${pageNum + 1}">
            </a>
            <span class="page-num current-page"
                  th:if="${pageNum == currentPage}"
                  th:text="${pageNum + 1}">
              </span>
          </th:block>
        </th:block>
        <a class="nav-link" th:if="${locationPage.hasNext()}" th:href="@{/bums/where.bs(page=${currentPage + 1})}">다음 &gt;</a>
        <span class="nav-link disabled" th:unless="${locationPage.hasNext()}">다음 &gt;</span>

        <a class="nav-link" th:if="${currentPage < totalPages - 1}" th:href="@{/bums/where.bs(page=${totalPages - 1})}">끝 &gt;&gt;</a>
        <span class="nav-link disabled" th:unless="${currentPage < totalPages - 1}">끝 &gt;&gt;</span>

      </th:block>
    </div>

  </div>
</th:block>
</html>