Location: PHPKode > scripts > WH Social > wh_social/framework/pagination.php
<?php

    $path = $_SERVER['PHP_SELF'];
    $total = intval(mysql_num_rows($count));
    $allsites = ceil($total / ENTRIES_ADMIN);
    $entries = ENTRIES_ADMIN;

    if(empty($_GET['page'])) {
        $page = 1;

    }elseif($_GET['page'] <= 0 || $_GET['page'] > $allsites) {
        $page = 1;

        }else{

        $page = mysql_real_escape_string($_GET['page']);
        }

    $links = array();

    if(($page - SITES_ADMIN) < 1){ $before = $page - 1;
        }else {

        $before = SITES_ADMIN;
        }

    if(($page + SITES_ADMIN) > $allsites){ $after = $allsites - $page;
        }else{

        $after = SITES_ADMIN;
        }

        $off = ($page - $before);

    if($page- $before > 1) {
        $first = 1;
        $links[] = '<a href="' . $path . '?page=' . $first . '" class="navigation">&laquo; ' . $lang['first_page'] . ' ...</a>';
        }

    if($page != 1) {
        $prev = $page-1;
        $links[] = '<a href="' . $path . '?page=' . $prev . '" class="navigation"> &laquo;</a>';
        }

    for($i = $off; $i <= ($page + $after); $i++) {

        if($i != $page) {
            $links[] = '<a href="' . $path . '?page=' . $i . '" class="navigation">' . $i . '</a>';

            }elseif($i == $allsites) {
            $links[] = '<span class="current">' . $i . '</span>';

            }elseif($i == $page) {
            $links[] = '<span class="current">' . $i . '</span>';
            }
        }

    if($page != $allsites) {
        $next = $page+1;
        $links[] = '<a href="' . $path . '?page=' . $next . '" class="navigation"> &raquo;</a>';
        }

    if($allsites - $page - SITES_ADMIN > 0 ) {
        $last = $allsites;
        $links[] = '<a href="' . $path . '?page=' . $last . '" class="navigation">... ' . $lang['last_page'] . ' &raquo;</a>';
        }

    $start = ($page-1) * ENTRIES_ADMIN;
    $link_string = implode(" ", $links);

?>
Return current item: WH Social