/** * Paginate the entries into snipped collection * * @return string The HTML String that appended to our template */ public function paginate() { $limit = $this->limit; if (is_null($limit)) { return; } $all = $this->entries->count(); $average = ceil($all / $limit); if ($average == 1) { return; } $skip = $this->app->request->get('!skip'); for ($i = 0; $i < $average; $i++) { $isCurrent = $skip == $i * $limit; $this->links[$i] = array('uri' => '?!skip=' . $i * $limit, 'isCurrent' => $isCurrent); if ($isCurrent) { $this->current = $i; } } return $this->app->theme->partial($this->partialTemplate, array('links' => $this->links, 'baseUrl' => $this->baseUrl, 'current' => $this->current, 'app' => $this->app)); }