function paginate(
		$pos=0,$size=10,$filter=NULL,array $options=NULL,$ttl=0,$bounce=TRUE) {
		$total=$this->count($filter,$options,$ttl);
		$count=ceil($total/$size);
		if ($bounce)
			$pos=max(0,min($pos,$count-1));
		return [
			'subset'=>($bounce || $pos<$count)?$this->find($filter,
				array_merge(
					$options?:[],
					['limit'=>$size,'offset'=>$pos*$size]
				),
				$ttl
			):[],
			'total'=>$total,
			'limit'=>$size,
			'count'=>$count,
			'pos'=>$bounce?($pos<$count?$pos:0):$pos
		];
	}
function paginate(
		$pos=0,$size=10,$filter=NULL,array $options=NULL,$ttl=0,$bounce=TRUE) {
		$total=$this->count($filter,$options,$ttl);
		$count=ceil($total/$size);
		if ($bounce)
			$pos=max(0,min($pos,$count-1));
		return [
			'subset'=>($bounce || $pos<$count)?$this->find($filter,
				array_merge(
					$options?:[],
					['limit'=>$size,'offset'=>$pos*$size]
				),
				$ttl
			):[],
			'total'=>$total,
			'limit'=>$size,
			'count'=>$count,
			'pos'=>$bounce?($pos<$count?$pos:0):$pos
		];
	}
function paginate ( $ pos = 0 , $ size = 10 , $ filter = NULL , array $ options = NULL , $ ttl = 0 , $ bounce = TRUE ) { $ total = $ this -> count ( $ filter , $ options , $ ttl ) ; $ count = ceil ( $ total / $ size ) ; if ( $ bounce ) $ pos = max ( 0 , min ( $ pos , $ count - 1 ) ) ; return [ 'subset' => ( $ bounce || $ pos < $ count ) ? $ this -> find ( $ filter , array_merge ( $ options ? : [ ] , [ 'limit' => $ size , 'offset' => $ pos * $ size ] ) , $ ttl ) : [ ] , 'total' => $ total , 'limit' => $ size , 'count' => $ count , 'pos' => $ bounce ? ( $ pos < $ count ? $ pos : 0 ) : $ pos ] ; }
Return array containing subset of records matching criteria,
total number of records in superset, specified limit, number of
subsets available, and actual subset position
@return array
@param $pos int
@param $size int
@param $filter string|array
@param $options array
@param $ttl int
@param $bounce bool
Return array containing subset of records matching criteria total number of records in superset specified limit number of subsets available and actual subset position