<commit_before><?php

class WebsiteHandler {
	function post(){

		$_POST = (array) json_decode(file_get_contents('php://input'));
		if(isset($_SERVER["CONTENT_TYPE"]) && strpos($_SERVER["CONTENT_TYPE"], "application/json") !== false) {
			$_POST = array_merge($_POST, (array) json_decode(trim(file_get_contents('php://input')), true));
		}

		global $db;
		$this->db = &$db;

		$websiteName = trim($_POST['name']);
		$websiteUrl = trim($_POST['url']);
		$websiteDescription = trim($_POST['description']);
		$websiteIdType = trim($_POST['id_type']);
		$websiteIdTheme = trim($_POST['id_theme']);

	 	$sql_insert = "INSERT INTO `website` 
	    ( `name`, `url`, `user_registered`, `description`, `id_type`, `id_theme`)
	    VALUES (:name, :url, :user_registered, :description, :id_type, :id_theme);";

	    $query_insert = $this->db->prepare($sql_insert);
	    $query_insert->bindValue('name', $websiteName, PDO::PARAM_STR);
	    $query_insert->bindValue('url', $websiteUrl, PDO::PARAM_STR);
	    $query_insert->bindValue('description', $websiteDescription, PDO::PARAM_STR);
	    $query_insert->bindValue('id_type', $websiteIdType, PDO::PARAM_INT);
	    $query_insert->bindValue('id_theme', $websiteIdTheme, PDO::PARAM_INT);

	    $query_insert->execute();

	    $websiteId = $this->db->lastInsertId();

	    header("HTTP/1.1 200 OK");
		echo json_encode(array('id' => $websiteId ));

	}

	function get($websiteId){

		global $db;
		$this->db = &$db;

		$sql = "SELECT * FROM `website` WHERE id = '".$websiteId."';";
		$stmt =  $this->db->query($sql);<commit_msg>post data<commit_after><?php

class WebsiteHandler {
	function post(){

		$_POST = (array) json_decode(file_get_contents('php://input'));
		if(isset($_SERVER["CONTENT_TYPE"]) && strpos($_SERVER["CONTENT_TYPE"], "application/json") !== false) {
			$_POST = array_merge($_POST, (array) json_decode(trim(file_get_contents('php://input')), true));
		}

		global $db;
		$this->db = &$db;

		$websiteName = trim($_POST['name']);
		$websiteUrl = trim($_POST['url']);
		$websiteDescription = trim($_POST['description']);
		$websiteIdType = trim($_POST['id_type']);
		$websiteIdTheme = trim($_POST['id_theme']);

	 	$sql_insert = "INSERT INTO `website` 
	    ( `name`, `url`, `description`, `id_type`, `id_theme`)
	    VALUES (:name, :url, :description, :id_type, :id_theme);";

	    $query_insert = $this->db->prepare($sql_insert);
	    $query_insert->bindValue('name', $websiteName, PDO::PARAM_STR);
	    $query_insert->bindValue('url', $websiteUrl, PDO::PARAM_STR);
	    $query_insert->bindValue('description', $websiteDescription, PDO::PARAM_STR);
	    $query_insert->bindValue('id_type', $websiteIdType, PDO::PARAM_INT);
	    $query_insert->bindValue('id_theme', $websiteIdTheme, PDO::PARAM_INT);

	    $query_insert->execute();

	    $websiteId = $this->db->lastInsertId();

	    header("HTTP/1.1 200 OK");
		echo json_encode(array('id' => $websiteId ));

	}

	function get($websiteId){

		global $db;
		$this->db = &$db;

		$sql = "SELECT * FROM `website` WHERE id = '".$websiteId."';";
		$stmt =  $this->db->query($sql);
{'fraction_non_alphanumeric': 0.20688535238713868, 'fraction_numerical': 0.003247807729782397, 'mean_word_length': 5.285714285714286, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2110066', 'n_tokens_mistral': 1164, 'n_tokens_neox': 1033, 'n_words': 176}