$inserts[] = DBLogger::log("hell", "o world10"); $inserts[] = DBLogger::log("hell", "o world11"); sleep(1); $inserts[] = DBLogger::log("hell", "o world12"); $inserts[] = DBLogger::log("hell", "o world13"); sleep(1); $inserts[] = DBLogger::log("hell", "o world14"); $inserts[] = DBLogger::log("hell", "o world15"); sleep(1); $inserts[] = DBLogger::log("hell", "o world16"); $inserts[] = DBLogger::log("hell", "o world17"); sleep(1); $inserts[] = DBLogger::log("hell", "o world18"); $inserts[] = DBLogger::log("hell", "o world19"); echo var_dump($inserts); $logs1 = DBLogger::GetLimitedBy("hell", 1, 10); echo var_dump($logs1); $logs2 = DBLogger::GetLimitedBy("hell", 11, 20); echo var_dump($logs2); if (sizeof($logs1) == 10 && sizeof($logs2) == 9) { echo "passed pageation<br />"; } else { echo "failed pageation<br />"; } DBLogger::delete($inserts); ?>
public function __construct() { parent::__construct(); // getting the user id $this->user_id = IsSetGetPost(USERS_USERID); if (!$this->user_id) { throw new UserActionException("no user selected"); } if (!is_numeric($this->user_id)) { throw new UserActionException("user id must be numeric"); } $this->start = IsSetGetPost('start', 0); $this->amount = IsSetGetPost('amount', 20); if (!is_numeric($this->start)) { $this->start = 0; } if (!is_numeric($this->amount)) { $this->amount = 20; } // get the username try { $user_factory = FCore::LoadDBFactory(BN_DBFACTORY_USERMODEL); $this->username = $user_factory->select_first( $this->user_id, array( DBFactory::SELECT_GET_ONLY => array( USERS_USERNAME ) )); if ($this->username == null) { $this->username = "******"; } else { $this->username = $this->username[USERS_USERNAME]; } } catch(Exception $e) { FCore::GetLogger()->log(Logger::LEVEL_ERROR, $e->getMessage()); DBLogger::log(BN_LOGTYPE_ERROR, $e->getMessage()); $this->username = "******"; } // getting the user logs try { $this->data = DBLogger::GetLimitedBy( USERS.$this->user_id, $this->start, $this->amount); } catch(DBLoggerException $e) { throw new UserActionException($e->getMessage()); } }