code: public function pagination($obj, $limit = 20) {
          if (true === 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]);
              if (isset($obj->pagination->next_max_id)) {
                  return $this->_makeCall($function, array('max_id' => $obj->pagination->next_max_id, 'count' => $limit));
              } else {
                  return $this->_makeCall($function, array('cursor' => $obj->pagination->next_cursor, 'count' => $limit));
              }
          } else {
              throw new PaginationException("Error: pagination() | This method doesn't support pagination.");
          }
      }
docs: Pagination feature
  
  @param object  $obj                  Instagram object returned by a method
  @param integer $limit                Limit of returned results
  @return mixed