<commit_before><?php

/**
 * @name        DB Module
 * @author      <NAME>
 * @author      <NAME>
 * @copyright   2014 by <NAME>, <NAME>
 */

if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');

function dbConnect() {

    global $dbUser, $dbPassword, $dbHost, $dbName;

    $database = new mysqli($dbHost, $dbUser, $dbPassword);

    if (mysqli_connect_errno()) {
	    echo mysqli_connect_errno().': '.mysqli_connect_error();
        return false;
	}

	if (!$database->select_db($dbName))
		if (!createDatabase($dbName, $database)) exit('Error: Could not create database!');
    if (!$database->query("SELECT * FROM lychee_photos, lychee_albums, lychee_settings;"))
    	if (!createTables($database)) exit('Error: Could not create tables!');
<commit_msg>Avoid sql injection on edge cases<commit_after><?php

/**
 * @name        DB Module
 * @author      <NAME>
 * @author      <NAME>
 * @copyright   2014 by <NAME>, <NAME>
 */

if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');

function dbConnect() {

    global $dbUser, $dbPassword, $dbHost, $dbName;

    $database = new mysqli($dbHost, $dbUser, $dbPassword);

    if (mysqli_connect_errno()) {
	    echo mysqli_connect_errno().': '.mysqli_connect_error();
        return false;
	}

	if (!$database->select_db($dbName))
		if (!createDatabase($dbName, $database)) exit('Error: Could not create database!');
    if (!$database->query("SELECT * FROM lychee_photos, lychee_albums, lychee_settings;"))
    	if (!createTables($database)) exit('Error: Could not create tables!');

    // Avoid sql injection
    $database->set_charset('GBK');

{'fraction_non_alphanumeric': 0.16574585635359115, 'fraction_numerical': 0.004910988336402701, 'mean_word_length': 4.077881619937695, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 16, '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': '4509304', 'n_tokens_mistral': 545, 'n_tokens_neox': 522, 'n_words': 135}