<commit_before><?php

namespace App\Http\Controllers\Api;

use abeautifulsite\SimpleImage;
use App\Http\Controllers\Controller;
use App\Http\Requests;
use App\Models\Upload;
use Auth;
use Cache;
use Exception;
use Helpers;
use Input;
use Storage;
use Teapot\StatusCode;

class ApiController extends Controller
{
    public function postUpload()
    {
        if (!Input::hasFile('file')) {
            return response()->json([trans('errors.upload_file_not_found')], StatusCode::BAD_REQUEST);
        }

        $file = Input::file('file');
        if (!$file->isValid()) {
            return response()->json([trans('errors.invalid_file_upload')], StatusCode::BAD_REQUEST);
        }

        if ($file->getSize() >= config('upste.upload_limit')) {
            return response()->json([trans('errors.upload_too_large')], StatusCode::REQUEST_ENTITY_TOO_LARGE);
        }

        // If this upload would hit the quota defined in .env, reject it.
        if (config('upste.user_storage_quota') > 0 && !Auth::user()->admin &&
            (Cache::get('uploads_size:' . Auth::user()->id) + $file->getSize()) >= config('upste.user_storage_quota')) {
            return response()->json([trans('errors.reached_upload_limit')], StatusCode::FORBIDDEN;
        }

        $ext = $file->getClientOriginalExtension();
        if (empty($ext)) {<commit_msg>Fix syntax error<commit_after><?php

namespace App\Http\Controllers\Api;

use abeautifulsite\SimpleImage;
use App\Http\Controllers\Controller;
use App\Http\Requests;
use App\Models\Upload;
use Auth;
use Cache;
use Exception;
use Helpers;
use Input;
use Storage;
use Teapot\StatusCode;

class ApiController extends Controller
{
    public function postUpload()
    {
        if (!Input::hasFile('file')) {
            return response()->json([trans('errors.upload_file_not_found')], StatusCode::BAD_REQUEST);
        }

        $file = Input::file('file');
        if (!$file->isValid()) {
            return response()->json([trans('errors.invalid_file_upload')], StatusCode::BAD_REQUEST);
        }

        if ($file->getSize() >= config('upste.upload_limit')) {
            return response()->json([trans('errors.upload_too_large')], StatusCode::REQUEST_ENTITY_TOO_LARGE);
        }

        // If this upload would hit the quota defined in .env, reject it.
        if (config('upste.user_storage_quota') > 0 && !Auth::user()->admin &&
            (Cache::get('uploads_size:' . Auth::user()->id) + $file->getSize()) >= config('upste.user_storage_quota')) {
            return response()->json([trans('errors.reached_upload_limit')], StatusCode::FORBIDDEN);
        }

        $ext = $file->getClientOriginalExtension();
        if (empty($ext)) {
{'fraction_non_alphanumeric': 0.15998515219005197, 'fraction_numerical': 0.0007423904974016332, 'mean_word_length': 3.4398682042833606, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, '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': '240367', 'n_tokens_mistral': 805, 'n_tokens_neox': 802, 'n_words': 156}