<commit_before><?php

namespace Boom\Asset;

use \Boom\Asset;
use Boom;
use \ORM as ORM;

class Finder extends Boom\Finder\Finder
{
    /**
	 *
	 * @var array
	 */
    protected $_allowedOrderByColumns = ['last_modified', 'title', 'downloads', 'filesize', 'uploaded_time'];

    public function __construct()
    {
        $this->_query = ORM::factory('Asset');
    }

    public function find()
    {
        $asset = parent::find();

        return Asset\Factory::fromModel($asset);
    }

    public function findAll()
    {
        $assets = parent::findAll();

        return new Finder\Result($assets);
    }

    /**
	 *
	 * @return array
	 */
//	public function get_count_and_total_size()
//	{
//		$query = clone $this->_query;
//		$query->reset();
//
//		$this->_applyFilters($query);
//
//		$result = $query
//			->select(array(DB::expr('sum(filesize)'), 'filesize'))
//			->select(array(DB::expr('count(*)'), 'count'))
//			->find();
//
//		return array(
//			'count' => $result->get('count'),
//			'filesize' => $result->get('filesize')
//		);
//	}

    public function setOrderBy($field, $direction = null)
    {
        in_array($field, $this->_allowedOrderByColumns) || $field = 'title';

        return parent::setOrderBy($field, $direction);
    }
}
<commit_msg>Fixed bug in asset finder<commit_after><?php

namespace Boom\Asset;

use \Boom;
use \ORM as ORM;

class Finder extends Boom\Finder\Finder
{
    /**
	 *
	 * @var array
	 */
    protected $_allowedOrderByColumns = ['last_modified', 'title', 'downloads', 'filesize', 'uploaded_time'];

    public function __construct()
    {
        $this->_query = ORM::factory('Asset');
    }

    public function find()
    {
        $asset = parent::find();

        return Asset\Factory::fromModel($asset);
    }

    public function findAll()
    {
        $assets = parent::findAll();

        return new Finder\Result($assets);
    }

    /**
	 *
	 * @return array
	 */
//	public function get_count_and_total_size()
//	{
//		$query = clone $this->_query;
//		$query->reset();
//
//		$this->_applyFilters($query);
//
//		$result = $query
//			->select(array(DB::expr('sum(filesize)'), 'filesize'))
//			->select(array(DB::expr('count(*)'), 'count'))
//			->find();
//
//		return array(
//			'count' => $result->get('count'),
//			'filesize' => $result->get('filesize')
//		);
//	}

    public function setOrderBy($field, $direction = null)
    {
        in_array($field, $this->_allowedOrderByColumns) || $field = 'title';

        return parent::setOrderBy($field, $direction);
    }
}

{'fraction_non_alphanumeric': 0.2004698512137823, 'fraction_numerical': 0.0, 'mean_word_length': 2.7573529411764706, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '899515', 'n_tokens_mistral': 897, 'n_tokens_neox': 863, 'n_words': 160}