<commit_before><?php
/**
 * REST Api Controller for Internal
 * 
 * @author <NAME>
 * @version 0.2
 */
 
class Api extends CI_Controller {

	private $api_version = '0.2';

	/**
	 * API Constructor
	 */
	public function  __construct() {
		parent::__construct();
		
		// Check Request Method
		if(!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'GET'))) {
			$this->_status(405); // Method Not Allowed
		}
		
	}
	
	/**
	 * Index: API Documentation
	 */
	public function index() {
		
		// Only allow GET
		if($this->input->post()) {
			$this->_status(405); // Method Not Allowed
		}
		
		$this->load->view('api/documentation', array('version' => $this->api_version));
	
	}
	
	/**
	 * Auth resource.
	 */
	public function auth() {
		
		// Require X-Email/Password auth.
		$this->_check_authentication();<commit_msg>Added check if method exists and disabled default 404 page.<commit_after><?php
/**
 * REST Api Controller for Internal
 * 
 * @author <NAME>
 * @version 0.2
 */
 
class Api extends CI_Controller {

	private $api_version = '0.2';

	/**
	 * API Constructor
	 */
	public function  __construct() {
		parent::__construct();
		
		// Check Request Method
		if(!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'GET'))) {
			$this->_status(405); // Method Not Allowed
		}
		
		// Check if method exists
		$method = $this->uri->segment(2);
		if(!empty($method) && !method_exists($this, $method)) {
			$this->_status(404); // Not Found
		}
	}
	
	/**
	 * Index: API Documentation
	 */
	public function index() {
		
		// Only allow GET
		if($this->input->post()) {
			$this->_status(405); // Method Not Allowed
		}
		
		$this->load->view('api/documentation', array('version' => $this->api_version));
	
	}
	
	/**
	 * Auth resource.
	 */
	public function auth() {
		
		// Require X-Email/Password auth.
		$this->_check_authentication();
{'fraction_non_alphanumeric': 0.17781402936378465, 'fraction_numerical': 0.01468189233278956, 'mean_word_length': 3.079822616407982, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 26, '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': '4416559', 'n_tokens_mistral': 689, 'n_tokens_neox': 576, 'n_words': 138}