<commit_before><?php

/**
 * Basfoiy App
 *
 */

Class BasCrowd
{
	private $config;
	private $db;
	private $view;

	public function __construct(Array $config)
	{
		$this->config = $config;
		// set database
		$this->db = new Db($this->config['db']);
		// set url params
		$this->url = new UrlHelper();
		// set view helper
		$this->view = new ViewHelper($this->config);

		if (session_status() == PHP_SESSION_NONE) session_start();

	}

	public function indexAction()
	{
		echo  "im alive";
	}


}

require_once 'Db.php';
require_once 'ViewHelper.php';<commit_msg>added crowd word browsing provider<commit_after><?php

/**
 * Basfoiy App
 *
 */

Class BasCrowd
{
	private $config;
	private $db;
	private $view;

	public function __construct(Array $config)
	{
		$this->config = $config;
		// set database
		$this->db = new Db($this->config['db']);
		// set url params
		$this->url = new UrlHelper();
		// set view helper
		$this->view = new ViewHelper($this->config);

		if (session_status() == PHP_SESSION_NONE) session_start();

	}

	public function indexAction()
	{
		echo  "im alive";
	}

	public function wordsAction()
	{
		$output = array('error' => true,'result' => 'An error has occured');
		$total = $this->db->query('select count(1) count from basdata');
		$total = $total[0]->count;
		$limit = intval($this->config['crowdlimit']);
		$pages = ceil($total / $limit);
		$page = intval($this->url->segment(3));
		$page = ($page == 0) ? 1 : $page;
		$offset = ($page - 1)  * $limit;

		$q = $this->db->prepare('select * from basdata limit :limit offset :offset');
		$q->bindParam(':limit', $limit, PDO:: PARAM_INT);
		$q->bindParam(':offset', $offset, PDO:: PARAM_INT);
		$result = $this->db->fetch($q);

		// respond as json
		header('Content-Type: application/json');
		if ($result !== false) 
		{
			$output['error'] = false;
			$output['result'] = $result;
		}
		echo json_encode($output);
	}

}

require_once 'Db.php';
require_once 'ViewHelper.php';
{'fraction_non_alphanumeric': 0.1883614088820827, 'fraction_numerical': 0.0030627871362940277, 'mean_word_length': 3.8157248157248156, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, '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': '6469734', 'n_tokens_mistral': 752, 'n_tokens_neox': 692, 'n_words': 165}