<?php
// Coalesce Operator
$start = $_GET['start'] ?? 1;
$per_page = 10;
$total_rows = 1000;
$paginator = new Barebone\Paginator($start,$per_page,$total_rows,'./');
$this->view->paginator = $paginator->generate_links(true);
// Or the long way around
$start = $_GET['start'] ?? 1;
$per_page = 8;
$total_rows = 677;
$paginator = new Barebone\Paginator();
$paginator->setBase_url('./');
$paginator->setCurrent_page($start);
$paginator->setPer_page($per_page);
$paginator->setTotal_rows($total_rows);
$paginator->setNum_links( 8 );
//print_r($paginator);
$this->view->paginator = $paginator;
Barebone\Paginator Object
(
[tag:protected] => ul
[innertext:protected] =>
[children:protected] => Array
(
[0] => Barebone\HTML\TElement Object
(
[tag:protected] => li
[innertext:protected] =>
[children:protected] => Array
(
[0] => Barebone\HTML\TElement Object
(
[tag:protected] => a
[innertext:protected] => First
[children:protected] => Array
(
)
[attributes:protected] => Array
(
[href] => Barebone\HTML\TAttribute Object
(
[name] => href
[value] => ./?start=0
)
[class] => Barebone\HTML\TAttribute Object
(
[name] => class
[value] => nav-buttons
)
)
)
)
[attributes:protected] => Array
(
)
)
[1] => Barebone\HTML\TElement Object
(
[tag:protected] => li
[innertext:protected] =>
[children:protected] => Array
(
[0] => Barebone\HTML\TElement Object
(
[tag:protected] => a
[innertext:protected] => Previous
[children:protected] => Array
(
)
[attributes:protected] => Array
(
[href] => Barebone\HTML\TAttribute Object
(
[name] => href
[value] => ./?start=160
)
[class] => Barebone\HTML\TAttribute Object
(
[name] => class
[value] => nav-buttons
)
)
)
)
[attributes:protected] => Array
(
)
)
[2] => Barebone\HTML\TElement Object
(
[tag:protected] => li
[innertext:protected] =>
[children:protected] => Array
(
[0] => Barebone\HTML\TElement Object
(
[tag:protected] => a
[innertext:protected] => 104
[children:protected] => Array
(
)
[attributes:protected] => Array
(
[href] => Barebone\HTML\TAttribute Object
(
[name] => href
[value] => ./?start=104
)
[class] => Barebone\HTML\TAttribute Object
(
[name] => class
[value] => nav-buttons
)
)
)
)
[attributes:protected] => Array
(
)
)
[3] => Barebone\HTML\TElement Object
(
[tag:protected] => li
[innertext:protected] =>
[children:protected] => Array
(
[0] => Barebone\HTML\TElement Object
(
[tag:protected] => a
[innertext:protected] => 112
[children:protected] => Array
(
)
[attributes:protected] => Array
(
[href] => Barebone\HTML\TAttribute Object
(
[name] => href
[value] => ./?start=112
)
[class] => Barebone\HTML\TAttribute Object
(
[name] => class
[value] => nav-buttons
)
)
)
)
[attributes:protected] => Array
(
)
)
[4] => Barebone\HTML\TElement Object
(
[tag:protected] => li
[innertext:protected] =>
[children:protected] => Array
(
[0] => Barebone\HTML\TElement Object
(
[tag:protected] => a
[innertext:protected] => 120
[children:protected] => Array
(
)
[attributes:protected] => Array
(
[href] => Barebone\HTML\TAttribute Object
(
[name] => href
[value] => ./?start=120
)
[class] => Barebone\HTML\TAttribute Object
(
[name] => class
[value] => nav-buttons
)
)
)
)
[attributes:protected] => Array
(
)
)
[5] => Barebone\HTML\TElement Object
(
[tag:protected] => li
[innertext:protected] =>
[children:protected] => Array
(
[0] => Barebone\HTML\TElement Object
(
[tag:protected] => a
[innertext:protected] => 128
[children:protected] => Array
(
)
[attributes:protected] => Array
(
[href] => Barebone\HTML\TAttribute Object
(
[name] => href
[value] => ./?start=128
)
[class] => Barebone\HTML\TAttribute Object
(
[name] => class
[value] => nav-buttons
)
)
)
)
[attributes:protected] => Array
(
)
)
[6] => Barebone\HTML\TElement Object
(
[tag:protected] => li
[innertext:protected] =>
[children:protected] => Array
(
[0] => Barebone\HTML\TElement Object
(
[tag:protected] => a
[innertext:protected] => 136
[children:protected] => Array
(
)
[attributes:protected] => Array
(
[href] => Barebone\HTML\TAttribute Object
(
[name] => href
[value] => ./?start=136
)
[class] => Barebone\HTML\TAttribute Object
(
[name] => class
[value] => nav-buttons
)
)
)
)
[attributes:protected] => Array
(
)
)
[7] => Barebone\HTML\TElement Object
(
[tag:protected] => li
[innertext:protected] =>
[children:protected] => Array
(
[0] => Barebone\HTML\TElement Object
(
[tag:protected] => a
[innertext:protected] => 144
[children:protected] => Array
(
)
[attributes:protected] => Array
(
[href] => Barebone\HTML\TAttribute Object
(
[name] => href
[value] => ./?start=144
)
[class] => Barebone\HTML\TAttribute Object
(
[name] => class
[value] => nav-buttons
)
)
)
)
[attributes:protected] => Array
(
)
)
[8] => Barebone\HTML\TElement Object
(
[tag:protected] => li
[innertext:protected] =>
[children:protected] => Array
(
[0] => Barebone\HTML\TElement Object
(
[tag:protected] => a
[innertext:protected] => 152
[children:protected] => Array
(
)
[attributes:protected] => Array
(
[href] => Barebone\HTML\TAttribute Object
(
[name] => href
[value] => ./?start=152
)
[class] => Barebone\HTML\TAttribute Object
(
[name] => class
[value] => nav-buttons
)
)
)
)
[attributes:protected] => Array
(
)
)
[9] => Barebone\HTML\TElement Object
(
[tag:protected] => li
[innertext:protected] =>
[children:protected] => Array
(
[0] => Barebone\HTML\TElement Object
(
[tag:protected] => a
[innertext:protected] => 160
[children:protected] => Array
(
)
[attributes:protected] => Array
(
[href] => Barebone\HTML\TAttribute Object
(
[name] => href
[value] => ./?start=160
)
[class] => Barebone\HTML\TAttribute Object
(
[name] => class
[value] => nav-buttons
)
)
)
)
[attributes:protected] => Array
(
)
)
[10] => Barebone\HTML\TElement Object
(
[tag:protected] => li
[innertext:protected] =>
[children:protected] => Array
(
[0] => Barebone\HTML\TElement Object
(
[tag:protected] => span
[innertext:protected] => 168
[children:protected] => Array
(
)
[attributes:protected] => Array
(
)
)
)
[attributes:protected] => Array
(
[class] => Barebone\HTML\TAttribute Object
(
[name] => class
[value] => active
)
)
)
[11] => Barebone\HTML\TElement Object
(
[tag:protected] => li
[innertext:protected] =>
[children:protected] => Array
(
[0] => Barebone\HTML\TElement Object
(
[tag:protected] => a
[innertext:protected] => 176
[children:protected] => Array
(
)
[attributes:protected] => Array
(
[href] => Barebone\HTML\TAttribute Object
(
[name] => href
[value] => ./?start=176
)
[class] => Barebone\HTML\TAttribute Object
(
[name] => class
[value] => nav-buttons
)
)
)
)
[attributes:protected] => Array
(
)
)
[12] => Barebone\HTML\TElement Object
(
[tag:protected] => li
[innertext:protected] =>
[children:protected] => Array
(
[0] => Barebone\HTML\TElement Object
(
[tag:protected] => a
[innertext:protected] => 184
[children:protected] => Array
(
)
[attributes:protected] => Array
(
[href] => Barebone\HTML\TAttribute Object
(
[name] => href
[value] => ./?start=184
)
[class] => Barebone\HTML\TAttribute Object
(
[name] => class
[value] => nav-buttons
)
)
)
)
[attributes:protected] => Array
(
)
)
[13] => Barebone\HTML\TElement Object
(
[tag:protected] => li
[innertext:protected] =>
[children:protected] => Array
(
[0] => Barebone\HTML\TElement Object
(
[tag:protected] => a
[innertext:protected] => 192
[children:protected] => Array
(
)
[attributes:protected] => Array
(
[href] => Barebone\HTML\TAttribute Object
(
[name] => href
[value] => ./?start=192
)
[class] => Barebone\HTML\TAttribute Object
(
[name] => class
[value] => nav-buttons
)
)
)
)
[attributes:protected] => Array
(
)
)
[14] => Barebone\HTML\TElement Object
(
[tag:protected] => li
[innertext:protected] =>
[children:protected] => Array
(
[0] => Barebone\HTML\TElement Object
(
[tag:protected] => a
[innertext:protected] => 200
[children:protected] => Array
(
)
[attributes:protected] => Array
(
[href] => Barebone\HTML\TAttribute Object
(
[name] => href
[value] => ./?start=200
)
[class] => Barebone\HTML\TAttribute Object
(
[name] => class
[value] => nav-buttons
)
)
)
)
[attributes:protected] => Array
(
)
)
[15] => Barebone\HTML\TElement Object
(
[tag:protected] => li
[innertext:protected] =>
[children:protected] => Array
(
[0] => Barebone\HTML\TElement Object
(
[tag:protected] => a
[innertext:protected] => 208
[children:protected] => Array
(
)
[attributes:protected] => Array
(
[href] => Barebone\HTML\TAttribute Object
(
[name] => href
[value] => ./?start=208
)
[class] => Barebone\HTML\TAttribute Object
(
[name] => class
[value] => nav-buttons
)
)
)
)
[attributes:protected] => Array
(
)
)
[16] => Barebone\HTML\TElement Object
(
[tag:protected] => li
[innertext:protected] =>
[children:protected] => Array
(
[0] => Barebone\HTML\TElement Object
(
[tag:protected] => a
[innertext:protected] => 216
[children:protected] => Array
(
)
[attributes:protected] => Array
(
[href] => Barebone\HTML\TAttribute Object
(
[name] => href
[value] => ./?start=216
)
[class] => Barebone\HTML\TAttribute Object
(
[name] => class
[value] => nav-buttons
)
)
)
)
[attributes:protected] => Array
(
)
)
[17] => Barebone\HTML\TElement Object
(
[tag:protected] => li
[innertext:protected] =>
[children:protected] => Array
(
[0] => Barebone\HTML\TElement Object
(
[tag:protected] => a
[innertext:protected] => 224
[children:protected] => Array
(
)
[attributes:protected] => Array
(
[href] => Barebone\HTML\TAttribute Object
(
[name] => href
[value] => ./?start=224
)
[class] => Barebone\HTML\TAttribute Object
(
[name] => class
[value] => nav-buttons
)
)
)
)
[attributes:protected] => Array
(
)
)
[18] => Barebone\HTML\TElement Object
(
[tag:protected] => li
[innertext:protected] =>
[children:protected] => Array
(
[0] => Barebone\HTML\TElement Object
(
[tag:protected] => a
[innertext:protected] => 232
[children:protected] => Array
(
)
[attributes:protected] => Array
(
[href] => Barebone\HTML\TAttribute Object
(
[name] => href
[value] => ./?start=232
)
[class] => Barebone\HTML\TAttribute Object
(
[name] => class
[value] => nav-buttons
)
)
)
)
[attributes:protected] => Array
(
)
)
[19] => Barebone\HTML\TElement Object
(
[tag:protected] => li
[innertext:protected] =>
[children:protected] => Array
(
[0] => Barebone\HTML\TElement Object
(
[tag:protected] => a
[innertext:protected] => Next
[children:protected] => Array
(
)
[attributes:protected] => Array
(
[href] => Barebone\HTML\TAttribute Object
(
[name] => href
[value] => ./?start=176
)
[class] => Barebone\HTML\TAttribute Object
(
[name] => class
[value] => nav-buttons
)
)
)
)
[attributes:protected] => Array
(
)
)
[20] => Barebone\HTML\TElement Object
(
[tag:protected] => li
[innertext:protected] =>
[children:protected] => Array
(
[0] => Barebone\HTML\TElement Object
(
[tag:protected] => a
[innertext:protected] => Last
[children:protected] => Array
(
)
[attributes:protected] => Array
(
[href] => Barebone\HTML\TAttribute Object
(
[name] => href
[value] => ./?start=672
)
[class] => Barebone\HTML\TAttribute Object
(
[name] => class
[value] => nav-buttons
)
)
)
)
[attributes:protected] => Array
(
)
)
)
[attributes:protected] => Array
(
[class] => Barebone\HTML\TAttribute Object
(
[name] => class
[value] => pagination
)
)
[base_url:Barebone\Paginator:private] => ./
[total_rows:Barebone\Paginator:private] => 677
[per_page:Barebone\Paginator:private] => 8
[num_links:Barebone\Paginator:private] => 8
[current_page:Barebone\Paginator:private] => 22
[first_link_txt:Barebone\Paginator:private] => First
[next_link_txt:Barebone\Paginator:private] => Next
[prev_link_txt:Barebone\Paginator:private] => Previous
[last_link_txt:Barebone\Paginator:private] => Last
[first_link:Barebone\Paginator:private] => Barebone\HTML\TElement Object
(
[tag:protected] => a
[innertext:protected] => First
[children:protected] => Array
(
)
[attributes:protected] => Array
(
[href] => Barebone\HTML\TAttribute Object
(
[name] => href
[value] => ./?start=0
)
[class] => Barebone\HTML\TAttribute Object
(
[name] => class
[value] => nav-buttons
)
)
)
[next_link:Barebone\Paginator:private] =>
[prev_link:Barebone\Paginator:private] =>
[last_link:Barebone\Paginator:private] =>
[page_link:Barebone\Paginator:private] =>
)