<commit_before><?php

/*

trip.php?stations=1,2,3&from=2012-01-31&to=2020-06-12

stations: list of stations
from: initial date
to: final date

aggregate: DAY_WEEK | DAY_YEAR | HOUR_DAY
coordinates: TRUE

*/

require_once 'private/mysqli.int';

header('Access-Control-Allow-Origin: *'); 


class Travel {
	public $count = "";
	public $hour = "";
	public $day = "";
	public $fromStation = "";
	public $toStation  = "";
	public $starttime = "";
	public $stoptime = "";
	public $from_lat = "";
	public $from_lon = "";
	public $to_lat = "";
	public $to_lon = "";
}

$ids = htmlentities($_GET['stations']);
if($ids == NULL) {
	$ids = "-1";
	$idDisabled = 1;
}
else
	$idDisabled = 0;

$toStationId = htmlentities($_GET['to_station']);
if($toStationId == NULL) {
	$toStationId = "%";
}

$from = htmlentities($_GET['from']);
if($from == NULL)
	$from = "2000-1-1";

$to = htmlentities($_GET['to']);
if($to == NULL)
	$to = "2100-12-31";

$modality = htmlentities($_GET['modality']);

$aggregate = htmlentities($_GET['aggregate']);
$coordinates = htmlentities($_GET['coordinates']);

// Filters
$gender = htmlentities($_GET['gender']);
$ageMin = htmlentities($_GET['age_min']);
$ageMax = htmlentities($_GET['age_max']);
$costumerType = htmlentities($_GET['customer_type']);

if($gender == NULL)
	$gender="%";

$ageDisabled="0";
if($ageMax == NULL || $ageMax == NULL)
	$ageDisabled="1";

if($costumerType == NULL)
	$costumerType="%";

$outStations = "";
if($modality != NULL)
	$outStations = "AND to_station_id IN ($ids)";

$database = new DataBaseMySQL();

switch($aggregate) {

	case "DAY_WEEK":
		$database->query("
							SELECT COUNT(*) as count, DATE_FORMAT(startdate,'%a') as day, from_station_id
							FROM TRIP 
						 	WHERE (from_station_id IN ($ids) OR '$idDisabled'='1')
						 		AND to_station_id LIKE '$toStationId'
								AND (startdate >= '$from 00:00' AND startdate <= '$to 23:59')<commit_msg>Fixed problem on DB API<commit_after><?php

/*

trip.php?stations=1,2,3&from=2012-01-31&to=2020-06-12

stations: list of stations
from: initial date
to: final date

aggregate: DAY_WEEK | DAY_YEAR | HOUR_DAY
coordinates: TRUE

*/

require_once 'private/mysqli.int';

header('Access-Control-Allow-Origin: *'); 


class Travel {
	public $count = "";
	public $hour = "";
	public $day = "";
	public $fromStation = "";
	public $toStation  = "";
	public $starttime = "";
	public $stoptime = "";
	public $from_lat = "";
	public $from_lon = "";
	public $to_lat = "";
	public $to_lon = "";
}

$ids = htmlentities($_GET['stations']);
if($ids == NULL) {
	$ids = "-1";
	$idDisabled = 1;
}
else
	$idDisabled = 0;

$toStationId = htmlentities($_GET['to_station']);
if($toStationId == NULL) {
	$toStationId = "%";
}

$from = htmlentities($_GET['from']);
if($from == NULL)
	$from = "2000-1-1";

$to = htmlentities($_GET['to']);
if($to == NULL)
	$to = "2100-12-31";

$modality = htmlentities($_GET['modality']);

$aggregate = htmlentities($_GET['aggregate']);
$coordinates = htmlentities($_GET['coordinates']);

// Filters
$gender = htmlentities($_GET['gender']);
$ageMin = htmlentities($_GET['age_min']);
$ageMax = htmlentities($_GET['age_max']);
$costumerType = htmlentities($_GET['customer_type']);

if($gender == NULL)
	$gender="%";

$ageDisabled="0";
if($ageMax == NULL || $ageMax == NULL)
	$ageDisabled="1";

if($costumerType == NULL)
	$costumerType="%";

$outStations = "";
if($modality != NULL)
	$outStations = "AND from_station_id IN ($ids) AND to_station_id IN ($ids)";

$database = new DataBaseMySQL();

switch($aggregate) {

	case "DAY_WEEK":
		$database->query("
							SELECT COUNT(*) as count, DATE_FORMAT(startdate,'%a') as day, from_station_id
							FROM TRIP 
						 	WHERE (from_station_id IN ($ids) OR '$idDisabled'='1')
						 		AND to_station_id LIKE '$toStationId'
								AND (startdate >= '$from 00:00' AND startdate <= '$to 23:59')
{'fraction_non_alphanumeric': 0.20130208333333333, 'fraction_numerical': 0.024479166666666666, 'mean_word_length': 4.918335901386749, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 7, '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': '6458585', 'n_tokens_mistral': 1539, 'n_tokens_neox': 1414, 'n_words': 293}