<commit_before><?php

/**
 * Description of TripController
 *
 * @author Mika
 */
if (isset($_GET['stats']) && !empty($_GET['stats'])) :
    $vehicle = array('vehicle_id' => (int) $_GET['stats']);
    if (($vehicle['vehicle_id'] === 0)):
        header('Location:http://' . BASE_URL . '/?profil&error=noStats');
    else :
        $current_vehicle = $vehicle_manager->get($vehicle);
        if(!$current_vehicle): header('Location:http://' . BASE_URL . '/?profil&error=noStats'); endif;
        $vehicle_exists = $vehicle_manager->exists($current_vehicle);
        if ($vehicle_exists):
            $current_user = (int) $_SESSION['user']['user_id'];
            $trip_exists = $trip_manager->exists($current_vehicle);
            if ($trip_exists):
                if ($vehicle_manager->is_vehicle_owner($current_vehicle, $current_user)) :
                    $vehicle_object = $current_vehicle;
                    $date = $trip_manager->getDate($current_vehicle);
                    if ($data !== false):
                        $last_modif = $date['date'];
                    endif;
                    $first_date_full = $trip_manager->getFirstDate($vehicle_object)->date;
                    $global_distance_full = $trip_manager->getDistanceTotal($vehicle_object)->distance;
                    $global_conso_full = $trip_manager->getGlobalConso($vehicle_object)->fuel_quantity;
                    $average_conso_full = (100 * $global_conso_full) / $global_distance_full;
                    $global_price_full = $trip_manager->getGlobalPrice($vehicle_object)->fuel_price;
                    $price_per_km_full = $global_price_full / $global_distance_full;
                    $first_date = number_format($first_date_full, 2);
                    $global_distance = number_format($global_distance_full, 2);
                    $global_conso = number_format($global_conso_full, 2);
                    $average_conso = number_format($average_conso_full, 2);
                    $global_price = number_format($global_price_full, 2);
                    $price_per_km = number_format($price_per_km_full, 2);
                else :
                    header('Location:http://' . BASE_URL . '/?profil&error=stats');<commit_msg>Adds correction on date format<commit_after><?php

/**
 * Description of TripController
 *
 * @author Mika
 */
if (isset($_GET['stats']) && !empty($_GET['stats'])) :
    $vehicle = array('vehicle_id' => (int) $_GET['stats']);
    if (($vehicle['vehicle_id'] === 0)):
        header('Location:http://' . BASE_URL . '/?profil&error=noStats');
    else :
        $current_vehicle = $vehicle_manager->get($vehicle);
        if(!$current_vehicle): header('Location:http://' . BASE_URL . '/?profil&error=noStats'); endif;
        $vehicle_exists = $vehicle_manager->exists($current_vehicle);
        if ($vehicle_exists):
            $current_user = (int) $_SESSION['user']['user_id'];
            $trip_exists = $trip_manager->exists($current_vehicle);
            if ($trip_exists):
                if ($vehicle_manager->is_vehicle_owner($current_vehicle, $current_user)) :
                    $vehicle_object = $current_vehicle;
                    $date = $trip_manager->getDate($current_vehicle);
                    if ($data !== false):
                        $last_modif = $date['date'];
                    endif;
                    $first_date = $trip_manager->getFirstDate($vehicle_object)->date;
                    $global_distance_full = $trip_manager->getDistanceTotal($vehicle_object)->distance;
                    $global_conso_full = $trip_manager->getGlobalConso($vehicle_object)->fuel_quantity;
                    $average_conso_full = (100 * $global_conso_full) / $global_distance_full;
                    $global_price_full = $trip_manager->getGlobalPrice($vehicle_object)->fuel_price;
                    $price_per_km_full = $global_price_full / $global_distance_full;
                    $global_distance = number_format($global_distance_full, 2);
                    $global_conso = number_format($global_conso_full, 2);
                    $average_conso = number_format($average_conso_full, 2);
                    $global_price = number_format($global_price_full, 2);
                    $price_per_km = number_format($price_per_km_full, 2);
                else :
                    header('Location:http://' . BASE_URL . '/?profil&error=stats');
{'fraction_non_alphanumeric': 0.13990929705215419, 'fraction_numerical': 0.004308390022675737, 'mean_word_length': 2.4434035909445746, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 31, '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': '2213765', 'n_tokens_mistral': 1349, 'n_tokens_neox': 1214, 'n_words': 176}