/**
  * Renders the block
  *
  * @param Context $context
  *
  * @return string
  */
 public function render(Context $context)
 {
     $output = parent::render($context);
     if ($this->lastValue == $output) {
         return '';
     } else {
         $this->lastValue = $output;
         return $this->lastValue;
     }
 }
 /**
  * Renders the tag
  *
  * @param Context $context
  *
  * @return string
  *
  */
 public function render(Context $context)
 {
     $this->currentPage = is_numeric($context->get('page')) ? $context->get('page') : 1;
     $this->currentOffset = ($this->currentPage - 1) * $this->numberItems;
     $this->collection = $context->get($this->collectionName);
     $this->collectionSize = count($this->collection);
     $this->totalPages = ceil($this->collectionSize / $this->numberItems);
     $paginatedCollection = array_slice($this->collection, $this->currentOffset, $this->numberItems);
     // Sets the collection if it's a key of another collection (ie search.results, collection.products, blog.articles)
     $segments = explode('.', $this->collectionName);
     if (count($segments) == 2) {
         $context->set($segments[0], array($segments[1] => $paginatedCollection));
     } else {
         $context->set($this->collectionName, $paginatedCollection);
     }
     $paginate = array('page_size' => $this->numberItems, 'current_page' => $this->currentPage, 'current_offset' => $this->currentOffset, 'pages' => $this->totalPages, 'items' => $this->collectionSize);
     if ($this->currentPage != 1) {
         $paginate['previous']['title'] = 'Previous';
         $paginate['previous']['url'] = $this->currentUrl($context) . '?page=' . ($this->currentPage - 1);
     }
     if ($this->currentPage != $this->totalPages) {
         $paginate['next']['title'] = 'Next';
         $paginate['next']['url'] = $this->currentUrl($context) . '?page=' . ($this->currentPage + 1);
     }
     $context->set('paginate', $paginate);
     return parent::render($context);
 }
 /**
  * Renders the block
  *
  * @param Context $context
  *
  * @return string
  */
 public function render(Context $context)
 {
     $output = parent::render($context);
     $context->set($this->to, $output);
     return '';
 }