$datasource = new Datasource($myarray);
// use a request object
$request = new A_Http_Request();
// create a request processor to set pager from GET parameters
$pager = new A_Pagination_Request($datasource);
$pager->setRangeSize(3)->process($request);
$url = new A_Pagination_Helper_Url();
$url->set('page', $pager->getCurrentPage());
$url->set('order_by', $pager->getOrderBy());
$rows = $pager->getItems();
// display the paging links ... should this goes in a template?
$links = array();
if ($pager->isPage(-1)) {
    $links[] = "<a href=\"" . $url->render(false, array('page' => $pager->getPage(-1))) . "\">Previous</a>";
}
if (!$pager->inPageRange($pager->getFirstPage())) {
    $links[] = "<a href=\"" . $url->render(false, array('page' => $pager->getFirstPage())) . "\">1</a> ... ";
}
//if ($pager->isIntervalPage(-10)) $links[] = "<a href=\"" . $url->render(false, array ('page' => $pager->getPage(-10))) . "\">" . $pager->getPage(-10) . "</a> ...";
foreach ($pager->getPageRange() as $page) {
    if ($page != $pager->getCurrentPage()) {
        $links[] = "<a href=\"" . $url->render(false, array('page' => $page)) . "\">{$page}</a>";
    } else {
        $links[] = $page;
    }
}
//if ($pager->isIntervalPage(+10)) $links[] = " ... <a href=\"" . $url->render(false, array ('page' => $pager->getPage(+10))) . "\">" . $pager->getPage(+10) . "</a>";
if (!$pager->inPageRange($pager->getLastPage())) {
    $links[] = " ... <a href=\"" . $url->render(false, array('page' => $pager->getLastPage())) . "\">" . $pager->getLastPage() . "</a>";
}
if ($pager->isPage(+1)) {