/**
  * Generate the content element
  */
 protected function compile()
 {
     $images = $this->facebookAlbum->getImages($this->facebook_album_order, $GLOBALS['objPage']->language, $this->metaIgnore, $GLOBALS['objPage']->rootFallbackLanguage);
     if (empty($images)) {
         return;
     }
     $images = array_values($images);
     // Limit the total number of items
     if ($this->numberOfItems > 0) {
         $images = array_slice($images, 0, $this->numberOfItems);
     }
     $offset = 0;
     $total = count($images);
     $limit = $total;
     // Pagination
     if ($this->perPage > 0) {
         // Get the current page
         $id = 'page_g' . $this->id;
         $page = \Input::get($id) !== null ? \Input::get($id) : 1;
         // Do not index or cache the page if the page number is outside the range
         if ($page < 1 || $page > max(ceil($total / $this->perPage), 1)) {
             /** @var \PageError404 $objHandler */
             $handler = new $GLOBALS['TL_PTY']['error_404']();
             $handler->generate($GLOBALS['objPage']->id);
         }
         // Set limit and offset
         $offset = ($page - 1) * $this->perPage;
         $limit = min($this->perPage + $offset, $total);
         $pagination = new \Pagination($total, $this->perPage, \Config::get('maxPaginationLinks'), $id);
         $this->Template->pagination = $pagination->generate("\n  ");
     }
     $this->Template->images = $this->generatePartial($images, $offset, $limit);
     // Add the album information
     if ($this->facebook_album_info) {
         $this->compileAlbumInfo($total);
     }
 }