<commit_before><?php

namespace Gatekeeper;

use Gatekeeper\Endpoints\Endpoint;


// detect endpoint if it has not already been set
if (!$_EVENT['request']->getEndpoint()) {

    if (!$Endpoint = Endpoint::getFromPath($_EVENT['request']->getPathStack())) {
        return ApiRequestHandler::throwNotFoundError('No endpoint was found that can handle this path');
    }

    // save determined endpoint to request object
    $_EVENT['request']->setEndpoint($Endpoint);
}<commit_msg>ensure entire portion of path that matches endpoint prefix does not get forwarded<commit_after><?php

namespace Gatekeeper;

use Gatekeeper\Endpoints\Endpoint;


// detect endpoint if it has not already been set
if (!$_EVENT['request']->getEndpoint()) {

    if (!$Endpoint = Endpoint::getFromPath($_EVENT['request']->getPathStack())) {
        return ApiRequestHandler::throwNotFoundError('No endpoint was found that can handle this path');
    }


    // trim path stack
    $_EVENT['request']->setPathStack(
        array_slice(
            $_EVENT['request']->getPathStack(),
            substr_count($Endpoint->Path, '/') + 1
        )
    );


    // save determined endpoint to request object
    $_EVENT['request']->setEndpoint($Endpoint);
}
{'fraction_non_alphanumeric': 0.13344182262001628, 'fraction_numerical': 0.0008136696501220504, 'mean_word_length': 3.9397590361445785, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 12, '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': '4558801', 'n_tokens_mistral': 324, 'n_tokens_neox': 317, 'n_words': 92}