<commit_before><?php

namespace NyroDev\UtilityBundle\Controller;

use NyroDev\UtilityBundle\Form\Type\AbstractFilterType;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\PropertyAccess\PropertyAccess;

abstract class AbstractAdminController extends AbstractController {
	
	const ADD = 'add';
	const EDIT = 'edit';

	protected function createList($repository, $route, array $routePrm = array(), $defaultSort = 'id', $defaultOrder = 'desc', AbstractFilterType $filterType = null, QueryBuilder $queryBuilder = null, $exportConfig = false) {
		$nbPerPage = $this->container->getParameter('nyrodev_utility.admin.nbPerPage');
		
		$tmpList = $this->getListElements($repository, $route, $defaultSort, $defaultOrder, $filterType, $queryBuilder);
		$orderBy = $tmpList['orderBy'];
		$order = $tmpList['order'];
		$sort = $tmpList['sort'];
		$filter = $tmpList['filter'];
		$page = $tmpList['page'];
		$queryBuilder = $tmpList['queryBuilder'];
		$total = $tmpList['total'];
		
		$canExport = $exportConfig && is_array($exportConfig) && isset($exportConfig['fields']);
		if ($canExport && $this->getRequest()->query->get('export')) {
			// Start XLS export
			$this->get('nyrodev')->increasePhpLimits();
			$phpExcel = new \PHPExcel();
			$title = isset($exportConfig['title']) ? $exportConfig['title'] : 'Export';
			$creator = isset($exportConfig['creator']) ? $exportConfig['creator'] : 'Export';
			$phpExcel->getProperties()->setCreator($creator)
							 ->setLastModifiedBy($creator)
							 ->setTitle($title)
							 ->setSubject($title);
			$sheet = $phpExcel->setActiveSheetIndex(0);
			$sheet->setTitle($title);
			
			$row = 1;
			$col = 0;
			foreach($exportConfig['fields'] as $field) {
				$fieldName = isset($exportConfig['prefix']) ? $this->trans('admin.'.$exportConfig['prefix'].'.'.$field) : $field;<commit_msg>Add parameter to change number per page in admin<commit_after><?php

namespace NyroDev\UtilityBundle\Controller;

use NyroDev\UtilityBundle\Form\Type\AbstractFilterType;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\PropertyAccess\PropertyAccess;

abstract class AbstractAdminController extends AbstractController {
	
	const ADD = 'add';
	const EDIT = 'edit';

	protected function createList($repository, $route, array $routePrm = array(), $defaultSort = 'id', $defaultOrder = 'desc', AbstractFilterType $filterType = null, QueryBuilder $queryBuilder = null, $exportConfig = false) {
		$nbPerPageParam = 'admin.nbPerPage.'.$route;
		$nbPerPage = $this->container->hasParameter($nbPerPageParam) ?
					$this->container->getParameter($nbPerPageParam) :
					$this->container->getParameter('nyrodev_utility.admin.nbPerPage');
		
		$tmpList = $this->getListElements($repository, $route, $defaultSort, $defaultOrder, $filterType, $queryBuilder);
		$orderBy = $tmpList['orderBy'];
		$order = $tmpList['order'];
		$sort = $tmpList['sort'];
		$filter = $tmpList['filter'];
		$page = $tmpList['page'];
		$queryBuilder = $tmpList['queryBuilder'];
		$total = $tmpList['total'];
		
		$canExport = $exportConfig && is_array($exportConfig) && isset($exportConfig['fields']);
		if ($canExport && $this->getRequest()->query->get('export')) {
			// Start XLS export
			$this->get('nyrodev')->increasePhpLimits();
			$phpExcel = new \PHPExcel();
			$title = isset($exportConfig['title']) ? $exportConfig['title'] : 'Export';
			$creator = isset($exportConfig['creator']) ? $exportConfig['creator'] : 'Export';
			$phpExcel->getProperties()->setCreator($creator)
							 ->setLastModifiedBy($creator)
							 ->setTitle($title)
							 ->setSubject($title);
			$sheet = $phpExcel->setActiveSheetIndex(0);
			$sheet->setTitle($title);
			
			$row = 1;
			$col = 0;
			foreach($exportConfig['fields'] as $field) {
				$fieldName = isset($exportConfig['prefix']) ? $this->trans('admin.'.$exportConfig['prefix'].'.'.$field) : $field;
{'fraction_non_alphanumeric': 0.17985424258198854, 'fraction_numerical': 0.0015616866215512754, 'mean_word_length': 5.480607082630692, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 39, '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': '2217745', 'n_tokens_mistral': 1322, 'n_tokens_neox': 1173, 'n_words': 215}