#if(newsPage2.totalPage<=5)
#setLocal(startPage = 1)
#setLocal(endPage = newsPage2.totalPage)
#for(page : [startPage..endPage])
#if(page == newsPage2.pageNumber)
#(page)
#else
#(page)
#end
#end
#elseif(newsPage2.pageNumber > 5 && newsPage2.pageNumber< newsPage2.totalPage)
FIRST
<
#setLocal(startPage = newsPage2.pageNumber-4)
#setLocal(endPage = newsPage2.pageNumber)
#for(page : [startPage..endPage])
#if(page == newsPage2.pageNumber)
#(page)
#else
#(page)
#end
#end
>
LAST
#elseif(newsPage2.pageNumber > 5 && newsPage2.pageNumber== newsPage2.totalPage)
FIRST
<
#setLocal(startPage = newsPage2.pageNumber-4)
#setLocal(endPage = newsPage2.pageNumber)
#for(page : [startPage..endPage])
#if(page == newsPage2.pageNumber)
#(page)
#else
#(page)
#end
#end
#else
#setLocal(startPage = 1)
#setLocal(endPage = 5)
#for(page : [startPage..endPage])
#if(page == newsPage2.pageNumber)
#(page)
#else
#(page)
#end
#end
>
LAST
#end