<commit_before><?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Main extends MY_Controller {
    public function index() {
        $this->load->model(['artwork_model', 'place_model', 'comment_model', 'pick_model']);
        $type = $this->input->get('type') ?: 'artworks';
        $query = $this->input->get('q');

        $pick_artworks = $this->artwork_model->get_pick_artworks();

        if ($type === 'artworks') {
            $result = $this->artwork_model->gets(9, 0, $query);
            $total_count = $this->artwork_model->get_total_count($query);
        } elseif ($type === 'places') {
            $result = $this->place_model->gets(9, 0, $query);
            $total_count = $this->place_model->get_total_count($query);

            if (!empty($result)) {
                foreach ($result as $res) {
                    $res->pick_count = $this->pick_model->get_count_by_place_id($res->id);
                    $res->comment_count = $this->comment_model->get_count_by_place_id($res->id);
                }
            }
        }

        $data = [
            'type' => $type,
            'query' => $query,
            'pick_artworks' => $pick_artworks,
            'items' => $result,
            'total_count' => $total_count<commit_msg>Remove unuseful logic<commit_after><?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Main extends MY_Controller {
    public function index() {
        $this->load->model(['artwork_model', 'place_model', 'comment_model', 'pick_model']);
        $type = $this->input->get('type') ?: 'artworks';
        $query = $this->input->get('q');

        $pick_artworks = $this->artwork_model->get_pick_artworks();

        if ($type === 'artworks') {
            $result = $this->artwork_model->gets(9, 0, $query);
            $total_count = $this->artwork_model->get_total_count($query);
        } elseif ($type === 'places') {
            $result = $this->place_model->gets(9, 0, $query);
            $total_count = $this->place_model->get_total_count($query);
        }

        $data = [
            'type' => $type,
            'query' => $query,
            'pick_artworks' => $pick_artworks,
            'items' => $result,
            'total_count' => $total_count
{'fraction_non_alphanumeric': 0.17533039647577092, 'fraction_numerical': 0.003524229074889868, 'mean_word_length': 2.3895522388059702, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 53, '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': '4490043', 'n_tokens_mistral': 705, 'n_tokens_neox': 690, 'n_words': 121}