<commit_before><?php

namespace Acme\Bundle\TestsBundle\Pages;

use PHPUnit_Framework_Assert;

class PageGrid extends Page
{

    protected $gridPath = '';

    protected $filtersPath = '';

    /**
     * Select random entity from current page
     *
     * @param int $pageSize
     * @return array
     */
    public function getRandomEntity($pageSize = 25)
    {
        $entityId = rand(1, $pageSize);

        $entity = $this->elements($this->using('xpath')->value("{$this->gridPath}//table/tbody/tr[{$entityId}]/td"));
        $headers = $this->elements($this->using('xpath')->value("{$this->gridPath}//table/thead/tr/th"));

        $entityData = array();
        for ($i=0; $i< count($headers); $i++) {
            $entityData[$headers[$i]->text()] = $entity[$i]->text();
        }
        return $entityData;
    }

    /**
     * Change current grid page
     *<commit_msg>BAP-570 Refactor Selenium Tests to use PageObject  - fixed default page size<commit_after><?php

namespace Acme\Bundle\TestsBundle\Pages;

use PHPUnit_Framework_Assert;

class PageGrid extends Page
{

    protected $gridPath = '';

    protected $filtersPath = '';

    /**
     * Select random entity from current page
     *
     * @param int $pageSize
     * @return array
     */
    public function getRandomEntity($pageSize = 10)
    {
        $entityId = rand(1, $pageSize);

        $entity = $this->elements($this->using('xpath')->value("{$this->gridPath}//table/tbody/tr[{$entityId}]/td"));
        $headers = $this->elements($this->using('xpath')->value("{$this->gridPath}//table/thead/tr/th"));

        $entityData = array();
        for ($i=0; $i< count($headers); $i++) {
            $entityData[$headers[$i]->text()] = $entity[$i]->text();
        }
        return $entityData;
    }

    /**
     * Change current grid page
     *
{'fraction_non_alphanumeric': 0.1780447842708902, 'fraction_numerical': 0.006007646095030038, 'mean_word_length': 2.716024340770791, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 23, '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': '6978638', 'n_tokens_mistral': 572, 'n_tokens_neox': 554, 'n_words': 110}