<commit_before><?php

/**
 * Standard representation of any URL that doesn't have a custom builder
 *
 * @package   ElkArte Forum
 * @copyright ElkArte Forum contributors
 * @license   BSD http://opensource.org/licenses/BSD-3-Clause (see accompanying LICENSE.txt file)
 *
 * @version 2.0 dev
 *
 */

namespace ElkArte\UrlGenerator\Standard;

use ElkArte\UrlGenerator\AbstractUrlGenerator;

/**
 * Class Standard
 *
 * @package ElkArte\UrlGenerator\Standard
 */
class Standard extends AbstractUrlGenerator
{
	/**
	 * {@inheritdoc }
	 */
	protected $_types = ['standard'];

	/**
	 * {@inheritdoc }
	 */
	public function generate($params)
	{
		return $this->generateQuery($params);
	}

	/**
	 * {@inheritdoc }
	 */
	protected function generateQuery($params)
	{
		$args = array();
		foreach ($params as $k => $v)
		{
			if (is_int($k))
			{
				if ($v === '')
				{
					continue;
				}

				$args[$k] = $v;
			}
			else
			{
				$args[$k] = $k . '=' . $v;
			}
		}

		$args = $this->getHash($args);

		return implode($this->_separator, $args);
	}
}
<commit_msg>Stuff that goes into the URL should at least be encoded<commit_after><?php

/**
 * Standard representation of any URL that doesn't have a custom builder
 *
 * @package   ElkArte Forum
 * @copyright ElkArte Forum contributors
 * @license   BSD http://opensource.org/licenses/BSD-3-Clause (see accompanying LICENSE.txt file)
 *
 * @version 2.0 dev
 *
 */

namespace ElkArte\UrlGenerator\Standard;

use ElkArte\UrlGenerator\AbstractUrlGenerator;

/**
 * Class Standard
 *
 * @package ElkArte\UrlGenerator\Standard
 */
class Standard extends AbstractUrlGenerator
{
	/**
	 * {@inheritdoc }
	 */
	protected $_types = ['standard'];

	/**
	 * {@inheritdoc }
	 */
	public function generate($params)
	{
		return $this->generateQuery($params);
	}

	/**
	 * {@inheritdoc }
	 */
	protected function generateQuery($params)
	{
		$args = array();
		foreach ($params as $k => $v)
		{
			if (is_int($k))
			{
				if ($v === '')
				{
					continue;
				}

				$args[$k] = $v;
			}
			else
			{
				$args[$k] = $k . '=' . urlencode($v);
			}
		}

		$args = $this->getHash($args);

		return implode($this->_separator, $args);
	}
}

{'fraction_non_alphanumeric': 0.1632088520055325, 'fraction_numerical': 0.0027662517289073307, 'mean_word_length': 3.011090573012939, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '1455253', 'n_tokens_mistral': 834, 'n_tokens_neox': 731, 'n_words': 166}