public static function pagination(html_link $link, $total, $current, $size = 25, $prefix = '') { if ($total <= $size) { return false; } $pages = ceil($total / $size); $links = array(); for ($i = 0; $i < $pages; $i++) { $links[$i + 1] = $link->pure(array($prefix . 'page' => $i)); } return template('iv.pagination')->render(array('total' => $total, 'current' => $current, 'pages' => $pages, 'size' => $size, 'links' => $links)); }