Example #1
0
eq(10, $p->which_last(3));
$p = new \ebi\Paginator(3, 2);
$list = array(1, 2, 3, 4, 5, 6, 7, 8, 9);
foreach ($list as $v) {
    $p->add($v);
}
eq(array(4, 5, 6), $p->contents());
eq(2, $p->current());
eq(1, $p->first());
eq(3, $p->last());
eq(9, $p->total());
$p = new \ebi\Paginator(3, 2);
$list = array(1, 2, 3, 4, 5);
foreach ($list as $v) {
    $p->add($v);
}
eq(array(4, 5), $p->contents());
eq(2, $p->current());
eq(1, $p->first());
eq(2, $p->last());
eq(5, $p->total());
$p = new \ebi\Paginator(3);
$list = array(1, 2);
foreach ($list as $v) {
    $p->add($v);
}
eq(array(1, 2), $p->contents());
eq(1, $p->current());
eq(1, $p->first());
eq(1, $p->last());
eq(2, $p->total());