public function PaginationSummary($context = 4)
    {
        $result = new ArrayList();
        $current = $this->CurrentPage();
        $total = $this->TotalPages();

        // Make the number even for offset calculations.
        if ($context % 2) {
            $context--;
        }

        // If the first or last page is current, then show all context on one
        // side of it - otherwise show half on both sides.
        if ($current == 1 || $current == $total) {
            $offset = $context;
        } else {
            $offset = floor($context / 2);
        }

        $left = max($current - $offset, 1);
        $right = min($current + $offset, $total);
        $range = range($current - $offset, $current + $offset);

        if ($left + $context > $total) {
            $left = $total - $context;
        }

        for ($i = 0; $i < $total; $i++) {
            $link = HTTP::setGetVar(
                $this->getPaginationGetVar(),
                $i * $this->getPageLength(),
                ($this->request instanceof HTTPRequest) ? $this->request->getURL(true) : null
            );
            $num = $i + 1;

            $emptyRange = $num != 1 && $num != $total && (
                $num == $left - 1 || $num == $right + 1
            );

            if ($emptyRange) {
                $result->push(new ArrayData(array(
                    'PageNum' => null,
                    'Link' => null,
                    'CurrentBool' => false
                )));
            } elseif ($num == 1 || $num == $total || in_array($num, $range)) {
                $result->push(new ArrayData(array(
                    'PageNum' => $num,
                    'Link' => $link,
                    'CurrentBool' => $current == $num
                )));
            }
        }

        return $result;
    }