Returns trending pins from http://pinterest.com/discover page. Uses topic id, that can be received
from $bot->topics->explore() method.

@param string $topicId
@param int $limit
@return Pagination
515906
public function explore($topicId, $limit = Pagination::DEFAULT_LIMIT)
    {
        $data = [
            'aux_fields' => [],
            'prepend'    => false,
            'offset'     => 180,
            'section_id' => $topicId,
        ];

        return $this->paginate(UrlBuilder::RESOURCE_EXPLORE_PINS, $data, $limit);
    }
1150971
public function paginateLines($offset = 0, $limit = 25, $term = null, $includeEmpty = true)
    {
        if (!is_int($offset))
            throw new \InvalidArgumentException('Argument 1 expected to be integer, '.gettype($offset).' seen.');
        if ($offset < 0)
            throw new \InvalidArgumentException('Argument 1 expected to be >= 0, "'.$offset.'" seen.');

        if (!is_int($limit))
            throw new \InvalidArgumentException('Argument 2 expected to be integer, '.gettype($limit).' seen.');
        if ($limit < -1)
            throw new \InvalidArgumentException('Argument 2 must be >= -1, "'.$limit.'" seen.');

        if ($limit === -1)
            $limit = count($this);

        if ($term === null)
            return $this->paginateLinesNoSearch($offset, $limit, $includeEmpty);

        return $this->paginateLinesSearch($offset, $limit, $term);
    }
1364411
public function pagination($obj, $limit = 0)
    {
        if (is_object($obj) && !is_null($obj->pagination)) {
            if (!isset($obj->pagination->next_url)) {
                return;
            }

            $apiCall = explode('?', $obj->pagination->next_url);

            if (count($apiCall) < 2) {
                return;
            }

            $function = str_replace(self::API_URL, '', $apiCall[0]);

            $auth = (strpos($apiCall[1], 'access_token') !== false);

            if (isset($obj->pagination->next_max_id)) {
                return $this->_makeCall($function, $auth, array('max_id' => $obj->pagination->next_max_id, 'count' => $limit));
            }

            return $this->_makeCall($function, $auth, array('cursor' => $obj->pagination->next_cursor, 'count' => $limit));
        }

        throw new InstagramException("Error: pagination() | This method doesn't support pagination.");
    }
348763
public function PaginatedProducts($limit = 10)
    {
        $products = $this->SortedProducts();
        $filter = $this->getFilter();

        if (count($filter)) {
            $products = $products->filter($filter);
        }

        return PaginatedList::create(
            $products,
            $this->getRequest()
        )->setPageLength($limit);
    }
634867
public function getItems($offset, $limit)
    {
        $query = $this->search->getQuery();
        $query->setFrom($offset);
        $query->setSize($limit);

        return $this->search->search()->getResults();
    }
1072369
public function GetByUser($UserID, $Limit, $Offset = 0) {
      // Get category permissions
      $Perms = DiscussionModel::CategoryPermissions();
      
      // Build main query
      $this->CommentQuery(TRUE, FALSE);
      $this->FireEvent('BeforeGet');
      $this->SQL
			->Select('d.Name', '', 'DiscussionName')
			->Join('Discussion d', 'c.DiscussionID = d.DiscussionID')
         ->Where('c.InsertUserID', $UserID)
			->OrderBy('c.CommentID', 'desc')
         ->Limit($Limit, $Offset);
      
      // Verify permissions (restricting by category if necessary)
      if($Perms !== TRUE) {
         $this->SQL
            ->Join('Category ca', 'd.CategoryID = ca.CategoryID', 'left')
            ->WhereIn('d.CategoryID', $Perms);
      }
      
      //$this->OrderBy($this->SQL);

      $Data = $this->SQL->Get();
      Gdn::UserModel()->JoinUsers($Data, array('InsertUserID', 'UpdateUserID'));
      
      return $Data;
      
   }
445527
protected function fetchNewsItems($begin, $end, $limit = null, $offset = null)
    {
        if (($criteria = $this->getSearchCriteria($begin, $end)) === null) {
            return null;
        }

        $criteria->setLimit($limit);
        $criteria->setOffset($offset);

        return NewsModel::findBy($criteria->getColumns(), $criteria->getValues(), $criteria->getOptions());
	}
726070
public function Index($ConversationID = FALSE, $Offset = -1, $Limit = '') {
      $this->Offset = $Offset;
      $Session = Gdn::Session();
      Gdn_Theme::Section('Conversation');
      
      // Figure out Conversation ID
      if (!is_numeric($ConversationID) || $ConversationID < 0)
         $ConversationID = 0;

      // Form setup for adding comments
      $this->Form->SetModel($this->ConversationMessageModel);
      $this->Form->AddHidden('ConversationID', $ConversationID);
      
      // Get conversation data
      $this->RecipientData = $this->ConversationModel->GetRecipients($ConversationID);
      $this->SetData('Recipients', $this->RecipientData);

      // Check permissions on the recipients.
      $InConversation = FALSE;
      foreach($this->RecipientData->Result() as $Recipient) {
         if ($Recipient->UserID == Gdn::Session()->UserID) {
            $InConversation = TRUE;
            break;
         }
      }
      if (!$InConversation) {
         // Conversation moderation must be enabled and they must have permission
         if (!C('Conversations.Moderation.Allow', FALSE)) {
            throw PermissionException();
         }
         $this->Permission('Conversations.Moderation.Manage');
      }
      
      $this->Conversation = $this->ConversationModel->GetID($ConversationID);
      $this->SetData('Conversation', $this->Conversation);
      
      // Bad conversation? Redirect
      if ($this->Conversation === FALSE)
         throw NotFoundException('Conversation');
      
      // Get limit
      if ($Limit == '' || !is_numeric($Limit) || $Limit < 0)
         $Limit = Gdn::Config('Conversations.Messages.PerPage', 50);
      
      // Calculate counts
      if (!is_numeric($this->Offset) || $this->Offset < 0) {
         // Round down to the appropriate offset based on the user's read messages & messages per page
         $CountReadMessages = $this->Conversation->CountMessages - $this->Conversation->CountNewMessages;
         if ($CountReadMessages < 0)
            $CountReadMessages = 0;
            
         if ($CountReadMessages > $this->Conversation->CountMessages)
            $CountReadMessages = $this->Conversation->CountMessages;
         
         // (((67 comments / 10 perpage) = 6.7) rounded down = 6) * 10 perpage = offset 60;
         $this->Offset = floor($CountReadMessages / $Limit) * $Limit;

         // Send the hash link in.
         if ($CountReadMessages > 1)
            $this->AddDefinition('LocationHash', '#Item_'.$CountReadMessages);
      }
      
      // Fetch message data
      $this->MessageData = $this->ConversationMessageModel->Get(
         $ConversationID,
         $Session->UserID,
         $this->Offset,
         $Limit
      );
      
      // Figure out who's participating.
      $this->Participants = '';
      $Count = 0;
      $Users = array();
      $InConversation = FALSE;
      foreach($this->RecipientData->Result() as $User) {
         $Count++;
         if($User->UserID == $Session->UserID) {
            $InConversation = TRUE;
            continue;
         }
         if($User->Deleted) {
            $Users[] = Wrap(UserAnchor($User), 'del', array('title' => sprintf(T('%s has left this conversation.'), htmlspecialchars($User->Name))));
            $this->SetData('_HasDeletedUsers', TRUE);
         } else
            $Users[] = UserAnchor($User);

         
      }
      if ($InConversation) {
         if(count($Users) == 0)
            $this->Participants = T('Just you!');
         else
            $this->Participants = sprintf(T('%s and you'), implode(', ', $Users));
      } else {
         $this->Participants = implode(', ', $Users);
      }
      
      $this->Title(strip_tags($this->Participants));

      // $CountMessages = $this->ConversationMessageModel->GetCount($ConversationID, $Session->UserID);
      
      // Build a pager
      $PagerFactory = new Gdn_PagerFactory();
      $this->Pager = $PagerFactory->GetPager('MorePager', $this);
      $this->Pager->MoreCode = 'Newer Messages';
      $this->Pager->LessCode = 'Older Messages';
      $this->Pager->ClientID = 'Pager';
      $this->Pager->Configure(
         $this->Offset,
         $Limit,
         $this->Conversation->CountMessages,
         'messages/'.$ConversationID.'/%1$s/%2$s/'
      );
      
      // Mark the conversation as ready by this user.
      $this->ConversationModel->MarkRead($ConversationID, $Session->UserID);
      
      // Deliver json data if necessary
      if ($this->_DeliveryType != DELIVERY_TYPE_ALL) {
         $this->SetJson('LessRow', $this->Pager->ToString('less'));
         $this->SetJson('MoreRow', $this->Pager->ToString('more'));
         $this->View = 'messages';
      }
      
      // Add modules.
      $ClearHistoryModule = new ClearHistoryModule($this);
      $ClearHistoryModule->ConversationID($ConversationID);
      $this->AddModule($ClearHistoryModule);
      
      $InThisConversationModule = new InThisConversationModule($this);
      $InThisConversationModule->SetData($this->RecipientData);
      $this->AddModule($InThisConversationModule);
      
      $this->AddModule('AddPeopleModule');
      
      $Subject = $this->Data('Conversation.Subject');
      if (!$Subject)
         $Subject = T('Message');
      
      $this->Data['Breadcrumbs'][] = array(
          'Name' => $Subject,
          Url('', '//'));
      
      // Render view
      $this->Render();
   }
503919
public function paginate($start, $limit, $fetchJoinCollection = true)
    {
        $this->setFirstResult($start)
             ->setMaxResults($limit);

        return new Paginator($this, $fetchJoinCollection);
    }
1012141
public function getList($limit, $offset = 0)
    {
        return $this->getEntityManager()->createQuery('
            SELECT
                n
            FROM
                AnimeDbAppBundle:Notice n
            ORDER BY
                n.date_created DESC
        ')
            ->setFirstResult($offset)
            ->setMaxResults($limit)
            ->getResult();
    }
855327
public function list(int $beginId = 0, int $limit = 50, string $status = 'CHECKING')
    {
        $params = [
            'begin_id' => $beginId,
            'limit' => $limit,
            'status' => $status,
        ];

        return $this->httpPostJson('card/submerchant/batchget', $params);
    }
282048
public static function paginate($limit = 10, $sql = '', $binding = [])
    {
        $page = request('page', 1);
        if (!is_numeric($page)) {
            $page = 1;
        }

        $offset = ($page - 1) * $limit;
        $sql .= " limit $limit offset $offset";
        $items = static::findAll($sql, $binding);
        $total = static::countAll($sql, $binding);

        return new Paginator($items, $page, $limit, $total);
    }
1264090
public function paginate($limit = null, $columns = ['*'], $pageName = 'page', $page = null)
    {
        return $this->simpleWrap(Action::READ, [$this, '_paginate']);
    }
709091
public Topic getTopic(String topicId) throws Exception {
    // [START pubsub_get_topic]
    try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
      ProjectTopicName topicName = ProjectTopicName.of(projectId, topicId);
      Topic topic = topicAdminClient.getTopic(topicName);
      return topic;
    }
    // [END pubsub_get_topic]
  }
902404
public function getPagedResults($limit = 50, $page = 0): Paginator
    {
        $dql = sprintf(self::DQL_GET_PAGED, TargetTemplate::class);
        return $this->getPaginator($dql, $limit, $page);
    }
680849
public function paginate($limit)
    {
        $capsule = $this->_database->getCapsule();
        $this->_model = $capsule->table($this->table);
        $paginator = new Pagination();
        $paginator->setLimit($limit)->setModel($this, $this->_model);

        return $paginator->paginate();
    }
301480
public function listCampaigns($limit = null, $offset = null)
    {
        $data = array();
        if (!empty($limit)) {
            $data['limit'] = $limit;
        }
        if (!empty($offset)) {
            $data['offset'] = $offset;
        }
        $requestResult = $this->sendRequest('campaigns', 'GET', $data);

        return $this->handleResult($requestResult);
    }