/**
  * Searches for waypoints
  */
 public function searchAction()
 {
     $numberPage = 1;
     if ($this->request->isPost()) {
         $query = Criteria::fromInput($this->di, "Waypoints", $_POST);
         $this->persistent->parameters = $query->getParams();
     } else {
         $numberPage = $this->request->getQuery("page", "int");
         if ($numberPage <= 0) {
             $numberPage = 1;
         }
     }
     $parameters = $this->persistent->parameters;
     if (!is_array($parameters)) {
         $parameters = array();
     }
     $parameters["order"] = "id";
     $waypoints = Waypoints::find($parameters);
     if (count($waypoints) == 0) {
         $this->flash->notice("The search did not find any waypoints");
         return $this->dispatcher->forward(array("controller" => "waypoints", "action" => "index"));
     }
     $paginator = new Paginator(array("data" => $waypoints, "limit" => 10, "page" => $numberPage));
     $this->view->page = $paginator->getPaginate();
 }