connector = $connector; } protected function paginate($url, $page = 0, $per_page = 0) { //TODO: Make a new base class and move paginate into it $query_string = array(); if ($page > 0) { $query_string[] = 'page='.(int)$page; } if ($per_page > 0) { $query_string[] = 'per_page='.(int)$per_page; } if (isset($query_string[0])) { $query = implode('&', $query_string); } else { $query = ''; } if (strlen($query) > 0) { if (strpos($url, '?') === false) { $url .= '?'.$query; } else { $url .= '&'.$query; } } return $url; } }