public function serve() {
        if(is_null($this->linkPath)) {
            $route = $this->fw->get('PARAMS.0');
            if($this->fw->exists('PARAMS.'.$this->routeKey))
                $route = preg_replace('/'.preg_quote($this->routeKeyPrefix.
                    $this->fw->get('PARAMS.'.$this->routeKey)).'$/','',$route);
            elseif(substr($route,-1) != '/')
                $route.= '/';
        } else
            $route = $this->linkPath;
        $this->fw->set('pg.route',$route);
        $this->fw->set('pg.prefix',$this->routeKeyPrefix);
        $this->fw->set('pg.currentPage',$this->current_page);
        $this->fw->set('pg.nextPage',$this->getNext());
        $this->fw->set('pg.prevPage',$this->getPrev());
        $this->fw->set('pg.firstPage',$this->getFirst());
        $this->fw->set('pg.lastPage',$this->getLast());
        $this->fw->set('pg.rangePages',$this->getInRange());
        $this->fw->set('pg.allPages',$this->getMax());
        $output = \Template::instance()->render($this->template);
        $this->fw->clear('pg');
        return $output;
    }