<commit_before><?php


namespace Minds\Controllers\api\v2\analytics;

use Minds\Api\Factory;
use Minds\Core;
use Minds\Core\Di\Di;
use Minds\Entities;
use Minds\Helpers\Counters;
use Minds\Interfaces;

class pageview implements Interfaces\Api, Interfaces\ApiIgnorePam
{
    public function get($pages)
    {
        return Factory::response([]);
    }

    public function post($pages)
    {
        if (!isset($_POST['url'])) {
            return Factory::response([
                'status' => 'error',
                'message' => 'You must provide a url'
            ]);
        }

        $url = $_POST['url'];

        $event = new Core\Analytics\Metrics\Event();
        $event
            ->setType('action')
            ->setProduct('platform')
            ->setAction('pageview')
            ->setRouteUri($url)
            ->setUserAgent($_SERVER['HTTP_USER_AGENT'])
            ->setCookieId($_COOKIE['minds']);

        if (isset($_POST['referrer']) && $_POST['referrer']) {
            $event->setReferrerUri((string) $_POST['referrer']);
        }

        if ($ip = $_SERVER['HTTP_X_FORWARDED_FOR']) {
            $event->setIpAddr($ip);
        }

        if (Core\Session::isLoggedIn()) {
            $event->setUserGuid(Core\Session::getLoggedInUser()->guid);
        }
        $event->push();

        return Factory::response([]);
    }

    public function put($pages)
    {
        return Factory::response([]);
    }

    public function delete($pages)
    {
        return Factory::response([]);
    }
<commit_msg>(feat): remove ip tracking<commit_after><?php


namespace Minds\Controllers\api\v2\analytics;

use Minds\Api\Factory;
use Minds\Core;
use Minds\Core\Di\Di;
use Minds\Entities;
use Minds\Helpers\Counters;
use Minds\Interfaces;

class pageview implements Interfaces\Api, Interfaces\ApiIgnorePam
{
    public function get($pages)
    {
        return Factory::response([]);
    }

    public function post($pages)
    {
        if (!isset($_POST['url'])) {
            return Factory::response([
                'status' => 'error',
                'message' => 'You must provide a url'
            ]);
        }

        $url = $_POST['url'];

        $event = new Core\Analytics\Metrics\Event();
        $event
            ->setType('action')
            ->setProduct('platform')
            ->setAction('pageview')
            ->setRouteUri($url)
            ->setUserAgent($_SERVER['HTTP_USER_AGENT'])
            ->setCookieId($_COOKIE['minds']);

        if (isset($_POST['referrer']) && $_POST['referrer']) {
            $event->setReferrerUri((string) $_POST['referrer']);
        }

        if (Core\Session::isLoggedIn()) {
            $event->setUserGuid(Core\Session::getLoggedInUser()->guid);
        }
        $event->push();

        return Factory::response([]);
    }

    public function put($pages)
    {
        return Factory::response([]);
    }

    public function delete($pages)
    {
        return Factory::response([]);
    }

{'fraction_non_alphanumeric': 0.15953177257525084, 'fraction_numerical': 0.0006688963210702341, 'mean_word_length': 2.1853035143769968, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 28, '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': '963805', 'n_tokens_mistral': 888, 'n_tokens_neox': 880, 'n_words': 153}