mhx
说明：
@param int $page
@param array $C 必须是索引数组 ， 返回的数组 同$C 循序相同
@param int $pagesize
@return mixed
6662
public static function multiPage(int $page ,array $C , int $pagesize = 10 ):array
    {
        if(!self::is_indexArray($C)){
            throw new \Exception('Tools multiPage throw : $C must is indexed array!');
        }
        //区间数组
        $scopeC = array();
        //区间指针记录
        $scopePointInteger = 0;
        //记录在数轴上个区间位置
        foreach($C as $k => $v){
            $scopeC[$k] = array($scopePointInteger ,$scopePointInteger + $v);
            $scopePointInteger += intval($v);
        }

//        if($scopePointInteger <= 0 ){
//            throw new \Exception('Tools multiPage throw : sum value of array $C must be greater than 0!');
//        }

        $count = $scopePointInteger;
        //print_r($scopeC);
        //最大页数
        $maxPage = ceil($count / $pagesize);
        //实际分页数据区间
        $OriginScopeL = ($page - 1) * $pagesize;
        $OriginScopeR = $OriginScopeL + $pagesize;

        //初始化limit 数组 , 使其下标同 $C一致
        $ScopeLimit = array();
        for($i=0;$i < count($C);$i++){
            $ScopeLimit[$i] = false;
        }
        foreach ($scopeC as $key => $value) {
            if($value[1] <= $OriginScopeL){
                //不取 0 ~ 起始点的数据
                //$ScopeLimit[$key] = false;
            }else{
                //起始点以后的数据
                //获取起始点位置 , 起始点大于阶段的起始点的时候需要借位 ， 反之等于当前区间的第一位 针对limit 等于 0 , ?
                $start = $value[0] > $OriginScopeL ? 0 : $OriginScopeL - $value[0];
                //该区间的结束点 针对Limit
                $maxEnd = $C[$key] - $start;
                //获取结束点 位置 , 看结束点是否大于区间结束点
                if($OriginScopeR > $value[1]){
                    $end = $maxEnd;
                    $ScopeLimit[$key] = ' limit '.$start.','.$end;
                }else{
                    //反之 等于本区间结束点
                    //取差值
                    $Borrow = $value[1] - $OriginScopeR;
                    //取剩余数
                    $end = $maxEnd - $Borrow;
                    $ScopeLimit[$key] = ' limit '.$start.','.$end;
                    //echo $ScopeLimit[$key];
                    break;
                }
            }
        }

        return [
            'page' => $page,
            'pagesize' => $pagesize,
            'count' => $count,
            'maxpage' => $maxPage,
            'limit' => $ScopeLimit
        ];

    }
933704
public function getPageParts(HasPagePartsInterface $page, $context = 'main')
    {
        /** @var $entityRepository PagePartRefRepository */
        $entityRepository = $this->em->getRepository('KunstmaanPagePartBundle:PagePartRef');
        $pageparts = $entityRepository->getPageParts($page, $context);

        return $pageparts;
    }
390033
public static function page(Page $c, $code = 302, $headers = array())
    {
        if ($c->getCollectionPath()) {
            $url = Core::make('helper/navigation')->getLinkToCollection($c, true);
        } else {
            $url = \URL::to($c);
        }
        $r = static::createRedirectResponse((string) $url, $code, $headers);

        return $r;
    }
1234826
public static function create($totalPage, $pageSize = 10, $page = 1, $gets = [])
    {
        $p = new PageUtil();
        if ($pageSize < 1) {
            $pageSize = 1;
        }

        $total = ceil($totalPage / $pageSize);

        if ($page < 1) {
            $page = 1;
        } else if ($page > $total) {
            $page = $total;
        }

        $p->page = $page;
        $p->gets = $gets;
        $p->total = $total;
        $p->pageSize = $pageSize;
        return $p;
    }
635797
public function getData($pageSize, $page)
    {
        $criteria = clone($this->sqlment);
        /* @var Criteria $criteria */
        $criteria->setLimit(($page - 1) * $pageSize);
        $criteria->setOffset($pageSize);
        return $this->db->findAll($criteria);
    }
932890
public function listAction($page = 1, $pageSize = 10, $sort = 'id', $sortDirection = "ASC")
    {
        return parent::listAction($page, $pageSize, $sort, $sortDirection);
    }
929856
public function Lists($pagesize=10){
    	
    	//如启用mongodb则使用mongodb
    	if($this->mongodb){
    		$res = $this->mongodbLists($pagesize);
    		return $res;
    		exit(0);
    	}
    	 
    	//mysql
    	// 查询状态为1的用户数据 并且每页显示10条数据
    	$list = self::where('status',1)->paginate($pagesize);
    	// 获取分页显示
    	$page = $list->render();
    	 
    	$res['list'] = $list;
    	$res['page'] = $page;
    	return $res;
    }
462852
public function paginate($page = 1, $pageSize = 10)
    {
        return $this
            ->limit($pageSize)
            ->offset($page > 1 ? $pageSize * ($page - 1) : 0);
    }
26905
final public function page($page = 1, $num = 10)
    {
        $page = max($page, 1);
        $start = ($page - 1) * $num;
        $this->limit($num, $start);
        $bak = $this->_sql;
        $infos = $this->_getAll();

        $this->_sql = $bak;
        $querySql = $this->sql;
        $total = $this->count();
        //重新组装两个SQL
        $this->sql = "Rows:" . $querySql . "\n Count:" . $this->sql;
        return [$infos, $total];
    }
731552
public static function create(
        string $queryText,
        int $page = self::DEFAULT_PAGE,
        int $size = self::DEFAULT_SIZE
    ): self {
        $page = (int) (max(1, $page));
        $query = new self($queryText);
        $query->from = ($page - 1) * $size;
        $query->size = $size;
        $query->page = $page;

        return $query;
    }
775634
private function get_page_size(?int $pagesize) : int {
        if (null === $pagesize || $pagesize <= 0) {
            $pagesize = discussion_list_vault::PAGESIZE_DEFAULT;
        }

        return $pagesize;
    }
419832
public function index($page = null)
    {
        $url = sprintf('buckets/%d/client/correspondences.json', $this->bucket);

        $correspondences = $this->client->get($url, [
            'query' => [
                'page' => $page,
            ],
        ]);

        return $this->indexResponse($correspondences, ClientCorrespondence::class);
    }
1185006
public function getPageParts(HasPagePartsInterface $page, $context = 'main')
    {
        $pagepartrefs = $this->getPagePartRefs($page, $context);

        // Group pagepartrefs per type and remember the sorting order
        $types = $order = array();
        $counter = 1;
        foreach ($pagepartrefs as $pagepartref) {
            $types[$pagepartref->getPagePartEntityname()][] = $pagepartref->getPagePartId();
            $order[$pagepartref->getPagePartEntityname() . $pagepartref->getPagePartId()] = $counter;
            ++$counter;
        }

        // Fetch all the pageparts (only one query per pagepart type)
        $pageparts = array();
        foreach ($types as $classname => $ids) {
            $result = $this->getEntityManager()->getRepository($classname)->findBy(array('id' => $ids));
            $pageparts = array_merge($pageparts, $result);
        }

        // Order the pageparts
        usort($pageparts, function (EntityInterface $a, EntityInterface $b) use ($order) {
            $aPosition = $order[get_class($a) . $a->getId()];
            $bPosition = $order[get_class($b) . $b->getId()];

            if ($aPosition < $bPosition) {
                return -1;
            } elseif ($aPosition > $bPosition) {
                return 1;
            }

            return 0;
        });

        return $pageparts;
    }
518425
public function setupSiteInterfaceLocalization(Page $c = null)
    {
        $app = Facade::getFacadeApplication();
        $loc = $app->make(Localization::class);
        $locale = null;
        if ($c === null) {
            $c = Page::getCurrentPage();
        }
        if ($c) {
            $pageController = $c->getPageController();
            if (is_callable([$pageController, 'useUserLocale'])) {
                $useUserLocale = $pageController->useUserLocale();
            } else {
                $dh = $app->make('helper/concrete/dashboard');
                $useUserLocale = $dh->inDashboard($c);
            }
            if ($useUserLocale) {
                $u = new User();
                $locale = $u->getUserLanguageToDisplay();
            } else {
                if ($this->isEnabled()) {
                    $ms = Section::getBySectionOfSite($c);
                    if (!$ms) {
                        $ms = static::getPreferredSection();
                    }
                    if ($ms) {
                        $locale = $ms->getLocale();

                        if ($this->canSetSessionValue()) {
                            $app->make('session')->set('multilingual_default_locale', $locale);
                        }
                    }
                }
                if (!$locale) {
                    $siteTree = $c->getSiteTreeObject();
                    if ($siteTree) {
                        $locale = $siteTree->getLocale()->getLocale();
                    }
                }
            }
        }
        if (!$locale) {
            $locale = $app->make('config')->get('concrete.locale');
        }
        $loc->setContextLocale(Localization::CONTEXT_SITE, $locale);
    }
1075907
public static int getPageCount(int size, int pageSize, int page) {
        int totalPage = size / pageSize;
        if (size > pageSize * totalPage) {
            totalPage += 1;
        }
        return totalPage;
    }
737202
public function page(int $page)
    {
        $this->query = array_merge($this->query ?? [], ['page' => $page]);

        return $this;
    }
559024
public function allowPage($page)
    {
        if (is_array($page)) {
            foreach ($page as $p) {
                $this->allowPage($p);
            }

            return $this;
        }
        $this->allowed_pages[] = $page;

        return $this;
    }