= $pages) {
		$from = 2;
		$to = $pages-1;
	} else {
		if($from <= 1) {
			$to = $page-1;
			$from = 2;
		} elseif($to >= $pages) {
			$from = $pages-($page-2);
			$to = $pages-1;
		}
		$more = 1;
	}
	if($curr_page>0) {
		$perpage = $curr_page == 1 ? 1 : $curr_page-1;
		$multipage .= ''.L('previous').'';
		if($curr_page==1) {
			$multipage .= ' 1';
		} elseif($curr_page>6 && $more) {
			$multipage .= ' 1..';
		} else {
			$multipage .= ' 1';
		}
	}
	for($i = $from; $i <= $to; $i++) {
		if($i != $curr_page) {
			$multipage .= ' '.$i.'';
		} else {
			$multipage .= ' '.$i.'';
		}
	}
	if($curr_page<$pages) {
		if($curr_page<$pages-5 && $more) {
			$multipage .= ' ..'.$pages.' '.L('next').'';
		} else {
			$multipage .= ' '.$pages.' '.L('next').'';
		}
	} elseif($curr_page==$pages) {
		$multipage .= ' '.$pages.' '.L('next').'';
	}
	return $multipage;
}
?>