<commit_before><?php

abstract class AMP_Base_Sanitizer {
	const FALLBACK_HEIGHT = 400;

	protected $DEFAULT_ARGS = array();

	protected $dom;
	protected $args;
	protected $did_convert_elements = false;

	public function __construct( $dom, $args = array() ) {
		$this->dom = $dom;
		$this->args = array_merge( $this->DEFAULT_ARGS, $args );
	}

	abstract public function sanitize();

	public function get_scripts() {
		return array();
	}

	public function get_styles() {
		return array();
	}

	protected function get_body_node() {
		return $this->dom->getElementsByTagName( 'body' )->item( 0 );
	}

	public function sanitize_dimension( $value, $dimension ) {
		if ( empty( $value ) ) {
			return $value;
		}

		if ( false !== filter_var( $value, FILTER_VALIDATE_INT ) ) {<commit_msg> #2468 added in master and will be pushed in 0.9.97.12<commit_after><?php

abstract class AMP_Base_Sanitizer {
	const FALLBACK_HEIGHT = 400;

	protected $DEFAULT_ARGS = array();

	protected $dom;
	protected $args;
	protected $did_convert_elements = false;
	/**
	 * The root element used for sanitization. Either html or body.
	 *
	 * @var DOMElement
	 */
	protected $root_element;

	public function __construct( $dom, $args = array() ) {
		$this->dom = $dom;
		$this->args = array_merge( $this->DEFAULT_ARGS, $args );
		if ( ! empty( $this->args['use_document_element'] ) ) {
			$this->root_element = $this->dom->documentElement;
		} else {
			$this->root_element = $this->dom->getElementsByTagName( 'body' )->item( 0 );
		}
	}

	abstract public function sanitize();

	public function get_scripts() {
		return array();
	}

	public function get_styles() {
		return array();
	}

	protected function get_body_node() {
		return $this->dom->getElementsByTagName( 'body' )->item( 0 );
	}

	public function sanitize_dimension( $value, $dimension ) {
		if ( empty( $value ) ) {
			return $value;
		}

		if ( false !== filter_var( $value, FILTER_VALIDATE_INT ) ) {
{'fraction_non_alphanumeric': 0.14300464636035107, 'fraction_numerical': 0.00980898296334538, 'mean_word_length': 4.113456464379947, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, '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': '1694669', 'n_tokens_mistral': 714, 'n_tokens_neox': 642, 'n_words': 167}