diff --git a/laravel/paginator.php b/laravel/paginator.php
index 2e63c495..9847804d 100644
--- a/laravel/paginator.php
+++ b/laravel/paginator.php
@@ -51,6 +51,13 @@ class Paginator {
*/
public $append = array();
+ /**
+ * The format that will be used to wrap the entire pagination string.
+ *
+ * @var string
+ */
+ protected $wrapper = '
';
+
/**
* Create a new Paginator instance.
*
@@ -96,7 +103,7 @@ public static function make($results, $total, $per_page)
*/
public static function page($total, $per_page)
{
- $page = Input::get('page', 1);
+ $page = IoC::container()->core('input')->get('page', 1);
if (is_numeric($page) and $page > $last_page = ceil($total / $per_page))
{
@@ -112,22 +119,17 @@ public static function page($total, $per_page)
* @param int $adjacent
* @return string
*/
- public function links($adjacent = 3)
+ public function links($adjacent = 4)
{
if ($this->last_page <= 1) return '';
- // The hard-coded "7" is to account for all of the constant elements in a sliding range.
- // Namely: The the current page, the two ellipses, the two beginning pages, and the two ending pages.
- if ($this->last_page < 7 + ($adjacent * 2))
- {
- $numbers = $this->range(1, $this->last_page);
- }
- else
- {
- $numbers = $this->slider($adjacent);
- }
+ // If there are two few pages to make showing a slider possible, we will just display a
+ // range of plain number links. The hard-coded "7" is to account for all of the constant
+ // elements in a sliding range, namely the current page, the two ellipses, the two
+ // beginning and ending pages.
+ $numbers = ($this->last_page < 7 + ($adjacent * 2)) ? $this->range(1, $this->last_page) : $this->slider($adjacent);
- return '';
+ return sprintf($this->wrapper, $this->previous().$numbers.$this->next());
}
/**
@@ -244,7 +246,9 @@ private function link($page, $text, $class)
$append .= '&'.$key.'='.$value;
}
- return HTML::link(Request::uri().'?page='.$page.$append, $text, compact('class'), Request::secure());
+ $request = IoC::container()->core('request');
+
+ return HTML::link($request->uri().'?page='.$page.$append, $text, compact('class'), $request->secure());
}
/**
@@ -256,6 +260,7 @@ private function link($page, $text, $class)
public function lang($language)
{
$this->language = $language;
+
return $this;
}
@@ -268,6 +273,7 @@ public function lang($language)
public function append($values)
{
$this->append = $values;
+
return $this;
}