<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가

//jQuery Mobile Style
function m_jQm_paging($write_pages, $cur_page, $total_page, $url, $add="") {

		if(!$cur_page) $cur_page = 1;
		if(!$total_page) $total_page = 1;

		$str = '';

		/*
		if ($cur_page < 2) {
			$str .= '<span class="pgPrevNext"><a title="맨앞페이지">First</a></span>';
		} else {
			$str .= '<span class="pgPrevNext"><a href="'.$url.'1'.$add.'" title="맨앞페이지">First</a></span>';
		}
		*/

		$start_page = ( ( (int)( ($cur_page - 1 ) / $write_pages ) ) * $write_pages ) + 1;
        $end_page = $start_page + $write_pages - 1;

        if ($end_page >= $total_page) { 
			$end_page = $total_page;
		}

        if ($start_page > 1) { 
			$str .= '<span class="pgPrevNext"><a href="'.$url.($start_page-1).$add.'" title="이전페이지">Prev</a></span>'; 
		} else {
			//$str .= '<span class="pgPrevNext"><a title="이전페이지">Prev</a></span>'; 
		}

        if ($total_page > 0){
                for ($k=$start_page;$k<=$end_page;$k++){
                        if ($cur_page != $k) {
		                    $str .= '<span class="pgNum"><a href="'.$url.$k.$add.'">'.$k.'</a></span>';
                        } else {
	                        $str .= '<span class="pgNow">'.$k.'</span> ';
						}
                }
        }

        if ($total_page > $end_page) {
			$str .= '<span class="pgPrevNext"><a href="'.$url.($end_page+1).$add.'" title="다음페이지">Next</a></span>';
		} else {
			//$str .= '<span class="pgPrevNext"><a title="다음페이지">Next</a></span>';
		}

		/*
		if ($cur_page < $total_page) {
			$str .= '<span class="pgPrevNext"><a href="'.$url.($total_page).$add.'" title="맨뒤페이지">Last</a></span>';
		} else {
			$str .= '<span class="pgPrevNext"><a title="맨뒤페이지">Last</a></span>';
		}
		*/

		return $str;
}

?>
<link rel="stylesheet" href="<?php echo $page_skin_url.'/'.$amina['page_css']; ?>.css">
<div class="paginate">
	<div class="pagelist">
		<?php echo m_jQm_paging($page_rows, $page, $total_page, G4_BBS_URL.'/board.php?bo_table='.$bo_table.$qstr.'&page='); ?>
	</div>
</div>