<commit_before><?php
/**
 * Page Application - Front Model
 */

defined('WITYCMS_VERSION') or die('Access denied');

/**
 * PageModel is the Front Model of the Page Application
 *
 * @package Apps\Page\Front
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @version 0.5.0-dev-07-10-2014
 */
class PageModel {
	/**
	 * @var WDatabase instance
	 */
	protected $db;
	
	public function __construct() {
		$this->db = WSystem::getDB();
		
		// Declare tables
		$this->db->declareTable('page');
		$this->db->declareTable('cats');
		$this->db->declareTable('cats_relations');
	}
	
	/**
	 * Counts page in the database
	 * 
	 * @return int
	 */
	public function countPage() {
		$prep = $this->db->prepare('
			SELECT COUNT(*)
			FROM page
		');
		$prep->execute();
		
		return intval($prep->fetchColumn());
	}
	
	/**
	 * Checks that a given ID matches a ID in the database
	 * 
	 * @param int $page_id
	 * @return bool
	 */
	public function validExistingPageId($page_id) {
		$page_id = intval($page_id);
		
		if ($page_id <= 0) {
			return false;<commit_msg>Cleanses page<commit_after><?php
/**
 * Page Application - Front Model
 */

defined('WITYCMS_VERSION') or die('Access denied');

/**
 * PageModel is the Front Model of the Page Application
 *
 * @package Apps\Page\Front
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @version 0.5.0-dev-07-10-2014
 */
class PageModel {
	/**
	 * @var WDatabase instance
	 */
	protected $db;
	
	public function __construct() {
		$this->db = WSystem::getDB();
		
		// Declare tables
		$this->db->declareTable('page');
	}
	
	/**
	 * Counts page in the database
	 * 
	 * @return int
	 */
	public function countPage() {
		$prep = $this->db->prepare('
			SELECT COUNT(*)
			FROM page
		');
		$prep->execute();
		
		return intval($prep->fetchColumn());
	}
	
	/**
	 * Checks that a given ID matches a ID in the database
	 * 
	 * @param int $page_id
	 * @return bool
	 */
	public function validExistingPageId($page_id) {
		$page_id = intval($page_id);
		
		if ($page_id <= 0) {
			return false;
{'fraction_non_alphanumeric': 0.16879293424926398, 'fraction_numerical': 0.011776251226692836, 'mean_word_length': 3.144308943089431, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1173328', 'n_tokens_mistral': 795, 'n_tokens_neox': 672, 'n_words': 178}