<%
	def totalPage = uicomponent.getAvailablePage();
	def currentPage = uicomponent.getCurrentPage();
	String previousPage = _ctx.appRes("UIPaginatorDefault.label.previous");
	String nextPage = _ctx.appRes("UIPaginatorDefault.label.next");
%>

<div class="UIPaginatorDefault">

  <% if( currentPage - 1 > 0 ){%>        
      <a href="<%=uicomponent.event("ShowPage","${currentPage - 1}")%>" class="Prev">$previousPage</a>
  <% }%>
  
  <%
  int min = 1;
  int max = totalPage;
  if(totalPage > 5 && currentPage > 2){
    min = currentPage - 2;
    max = currentPage + 3;
    if (max > totalPage) max = totalPage;
  } else if( totalPage > 5 && currentPage < 3 ){
    min = 1;
    max = 6;
  }
  for( i in min..max) { %>
  <%  if( i == currentPage) { %>
	    <a class="Item Current"><%=i%></a>
  <%  } else { %>
	    <a href="<%=uicomponent.event("ShowPage","$i")%>" class="Item"><%=i%></a>
  <%  } %> 
  <%}%>    
  
  <% if(currentPage + 1 <= totalPage) { %>
       <a href="<%=uicomponent.event("ShowPage","${currentPage + 1}")%>" class="Next">$nextPage</a>	
  <% }%>
    
</div>