<commit_before><?php

$app->get('/mod/{id}[/{name}]', function($request, $response, $args) {
    return $this->view->render($response, 'templates/mod.html', [
        'modid' => $args['id']
    ]);
})->setName('mod.view');

$app->get('/random', function($request, $response, $args) {
    $backend_url = $this->get('settings')['backend-url'];
    $gameshort = $this->get('settings')['gameshort'];
    $json = file_get_contents('http://'  . $backend_url . '/api/mods/' . $gameshort . '/random');
    $random_mod = json_decode($json);

    return $response->withRedirec('/mod/ '.$random_mod->data[0]->id);
})->setName('mod.random');

?><commit_msg>Append mod name to /random redirect, use 302 redirect<commit_after><?php

$app->get('/mod/{id}[/{name}]', function($request, $response, $args) {
    return $this->view->render($response, 'templates/mod.html', [
        'modid' => $args['id']
    ]);
})->setName('mod.view');

$app->get('/random', function($request, $response, $args) {
    $backend_url = $this->get('settings')['backend-url'];
    $gameshort = $this->get('settings')['gameshort'];
    $json = file_get_contents("http://{$backend_url}/api/mods/{$gameshort}/random");
    $random_mod = json_decode($json, true);

    return $response->withRedirect("mod/{$random_mod['data']['id']}/{$random_mod['data']['name']}", 302);
})->setName('mod.random');

?>
{'fraction_non_alphanumeric': 0.26048565121412803, 'fraction_numerical': 0.0051508462104488595, 'mean_word_length': 4.887445887445887, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, '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': '4459185', 'n_tokens_mistral': 479, 'n_tokens_neox': 466, 'n_words': 67}