public function Pages($max = null)
    {
        $result = new ArrayList();

        if ($max) {
            $start = ($this->CurrentPage() - floor($max / 2)) - 1;
            $end = $this->CurrentPage() + floor($max / 2);

            if ($start < 0) {
                $start = 0;
                $end = $max;
            }

            if ($end > $this->TotalPages()) {
                $end = $this->TotalPages();
                $start = max(0, $end - $max);
            }
        } else {
            $start = 0;
            $end = $this->TotalPages();
        }

        for ($i = $start; $i < $end; $i++) {
            $result->push(new ArrayData(array(
                'PageNum' => $i + 1,
                'Link' => HTTP::setGetVar(
                    $this->getPaginationGetVar(),
                    $i * $this->getPageLength(),
                    ($this->request instanceof HTTPRequest) ? $this->request->getURL(true) : null
                ),
                'CurrentBool' => $this->CurrentPage() == ($i + 1)
            )));
        }

        return $result;
    }