<commit_before>var childProcess = require( "child_process" );
var phantomjs = require( "phantomjs-prebuilt" );
var path = require( "path" );

function PhantomGlyphHangerSpider() {
	this.limit = 10;
}

PhantomGlyphHangerSpider.prototype.setLimit = function( limit ) {
	if( limit !== undefined ) {
		this.limit = limit;
	}
};

PhantomGlyphHangerSpider.prototype.getArguments = function() {
	// order is important here
	var args = [
		path.join( __dirname, "..", "phantomjs-urls.js" )
	];
	return args;
};

PhantomGlyphHangerSpider.prototype.findUrls = function( url, callback ) {
	var args = this.getArguments();

	childProcess.execFile( phantomjs.path, args.concat( url ), function( error, stdout, stderr ) {
		if( error ) {
			throw error;
		}

		var urls = stdout.trim().split( "\n" );
		callback( this.limit ? urls.slice( 0, this.limit ) : urls );
	}.bind( this ));
};

module.exports = PhantomGlyphHangerSpider;<commit_msg>Fix for issue with `--spider-limit` without `--spider` (was limited to one url)<commit_after>var childProcess = require( "child_process" );
var phantomjs = require( "phantomjs-prebuilt" );
var path = require( "path" );

function PhantomGlyphHangerSpider() {
	this.defaultLimit = 10;
	this.limit = this.defaultLimit;
}

PhantomGlyphHangerSpider.prototype.setLimit = function( limit ) {
	if( limit === true ) {
		this.limit = this.defaultLimit;
	} else if( limit !== undefined ) {
		this.limit = limit;
	}
};

PhantomGlyphHangerSpider.prototype.getArguments = function() {
	// order is important here
	var args = [
		path.join( __dirname, "..", "phantomjs-urls.js" )
	];
	return args;
};

PhantomGlyphHangerSpider.prototype.findUrls = function( url, callback ) {
	var args = this.getArguments();

	childProcess.execFile( phantomjs.path, args.concat( url ), function( error, stdout, stderr ) {
		if( error ) {
			throw error;
		}
		var urls = stdout.trim().split( "\n" );
		callback( this.limit ? urls.slice( 0, this.limit ) : urls );
	}.bind( this ));
};

module.exports = PhantomGlyphHangerSpider;
{'fraction_non_alphanumeric': 0.1493570722057369, 'fraction_numerical': 0.002967359050445104, 'mean_word_length': 4.213917525773196, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '222650', 'n_tokens_mistral': 742, 'n_tokens_neox': 691, 'n_words': 158}