<commit_before><?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Stations extends CI_Controller {

	public function __construct()
	{
		parent::__construct();
		$this->load->library('stationsFetcher');
		date_default_timezone_set('Europe/Zagreb');
	}

	public function _remap($method)
	{
		$trainNo = intval($method);

		if ($trainNo > 0)
		{
			$this->_stations($trainNo);
		}
		else
		{
			show_error('400 Bad Request', 400);
		}
	}

	private function _stations($trainNo)
	{
		$stations = $this->stationsfetcher->getStations($trainNo);

		$data = array(
			'generatedTime' => date('H:i:s'),
			'stations' => $stations
		);

		$json = json_encode($data);

		$this->output->set_header('Cache-Control: no-cache, must-revalidate');
		$this->output->set_header('Pragma: no-cache');

		if ($this->input->get('callback'))
		{
			$this->output->set_content_type('application/javascript');
			$this->output->set_output("{$this->input->get('callback')}($json)");
		}
		else
		{
			$this->output->set_content_type('application/json');
			$this->output->set_output($json);
		}
	}
}<commit_msg>Disable unicode escaping and specify charset in stations JSON output<commit_after><?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Stations extends CI_Controller {

	public function __construct()
	{
		parent::__construct();
		$this->load->library('stationsFetcher');
		date_default_timezone_set('Europe/Zagreb');
	}

	public function _remap($method)
	{
		$trainNo = intval($method);

		if ($trainNo > 0)
		{
			$this->_stations($trainNo);
		}
		else
		{
			show_error('400 Bad Request', 400);
		}
	}

	private function _stations($trainNo)
	{
		$stations = $this->stationsfetcher->getStations($trainNo);

		$data = array(
			'generatedTime' => date('H:i:s'),
			'stations' => $stations
		);

		$json = json_encode($data, JSON_UNESCAPED_UNICODE);

		$this->output->set_header('Cache-Control: no-cache, must-revalidate');
		$this->output->set_header('Pragma: no-cache');

		if ($this->input->get('callback'))
		{
			$this->output->set_content_type('application/javascript;charset=UTF-8');
			$this->output->set_output("{$this->input->get('callback')}($json)");
		}
		else
		{
			$this->output->set_content_type('application/json;charset=UTF-8');
			$this->output->set_output($json);
		}
	}
}
{'fraction_non_alphanumeric': 0.1880085653104925, 'fraction_numerical': 0.006852248394004282, 'mean_word_length': 4.767901234567901, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 51, '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': '5872260', 'n_tokens_mistral': 918, 'n_tokens_neox': 809, 'n_words': 124}