<commit_before>function contentController ($scope, $location,$http) {
	$scope.access_token= "";
	$scope.page_name = "";
	$scope.show = false;
	$scope.qdata = [];
	$scope.next = false;
	$scope.prev = false;
	$scope.count = 0;
	$scope.searching = false;
	$scope.countDirection = true; //true for positive (++)

	$scope.countEqualsZero = function () {
		if($scope.count==0)
			return true;
		return false;
	}
	//for clearfix class;
	$scope.indexDivByThree = function (index) {
		if((index+1) % 3 == 0 )
			return true;
		else return false;
	}

	$scope.lessPost = function () {
		if($scope.count<=25)
			return true;
		return false;
	}

	$scope.GetDate = function (date) {
		var d = new Date(date);
      return d;
	}
	window.fbAsyncInit = function() {
	FB.init({
		//facebook app id
	  appId      : '494795677343992',
	  cookie     : true,  // enable cookies to allow the server to access 
	                      // the session
	  xfbml      : true,  // parse social plugins on this page
	  version    : 'v2.0', // use version 2.0
	  status     : true
	});

	FB.Event.subscribe('auth.authResponseChange', function(response) {
	     if (response.status === 'connected') 
	     {
	     	console.log(response);
	        $scope.access_token = response.authResponse.accessToken;
	        $scope.show = true;
	        $scope.$apply();
	     }   
	     else if (response.status === 'not_authorized') 
	    {
	        console.log('logged In fail');
	    } else
	    {
	        //UNKNOWN ERROR. Logged Out
	        $scope.access_token = '';
	        $scope.show = false;
	        console.log('logged In failed');
	    }
	});
	FB.Event.subscribe('auth.login', function(response) {
	  console.log(response);
	});
	};
	$scope.findPage = function (type) {
		var l = Ladda.create(document.getElementById('mainBtn'));
		l1 = Ladda.create(document.getElementById('prevBtn'));
		l2 = Ladda.create(document.getElementById('nextBtn'));
		l.start();
		l1.start();
		l2.start();
		$scope.message = '';
		$scope.qdata=[];
		if(type=='fresh'){
			$scope.countDirection = true;
			$scope.searching = false;
			$scope.count = 0;
			url = "https://graph.facebook.com/"+$scope.page_name+"/posts/?access_token="+$scope.access_token;
		}
		if(type =='next'){
			$scope.countDirection = true;
			url = $scope.paging.next;
		}
		if(type =='prev'){
			$scope.countDirection = false;
			url = $scope.paging.previous;
		}
		$.ajax({
		url: url,
		type: "GET",
		success : function (data) {
			console.log(data);
			search = data.data;
			if(search.length==0){
				$scope.message = 'No posts available to search';
			}
			console.log($scope.search_string);
			if($scope.search_string == undefined ||$scope.search_string == ' '){
				$scope.message = 'wrong query';
				return;
			}
			$scope.searching = true;
			for (var i = 0; i < search.length; i++) {
				if($scope.countDirection)
					$scope.count++;
				else
					$scope.count--;
				console.log(search[i].message);
				if(search[i].message!==undefined){
					if(search[i].message.toLowerCase().search($scope.search_string.toLowerCase())!=-1){
						$scope.qdata.push(search[i]);
					}else if(search[i].name!==undefined){
						if(search[i].name.toLowerCase().search($scope.search_string.toLowerCase())!=-1){
							$scope.qdata.push(search[i]);
						}	
					}
				}else if(search[i].description!==undefined){
					if(search[i].description.toLowerCase().search($scope.search_string.toLowerCase())!=-1){
						$scope.qdata.push(search[i]);
					}
				}
			};
			if(data.paging !==undefined){
				$scope.paging = data.paging;
				$scope.next = true;	
				$scope.prev = true;
			} 
			if($scope.qdata.length==0){
				$scope.findPage('next');
			}else{
				$scope.message = '';
			}
			l.stop();
			l1.stop();
			l2.stop();
			console.log($scope.qdata);
			// if(data.paging !==undefined){
			// 	$scope.paging = data.paging;
			// 	$scope.next = true;	
			// 	$scope.prev = true;
			// } 
			console.log($scope.paging);<commit_msg>fixed some issues<commit_after>function contentController ($scope, $location,$http) {
	$scope.access_token= "";
	$scope.page_name = "";
	$scope.show = false;
	$scope.qdata = [];
	$scope.next = false;
	$scope.prev = false;
	$scope.count = 0;
	$scope.searching = false;
	$scope.countDirection = true; //true for positive (++)

	$scope.countEqualsZero = function () {
		if($scope.count==0)
			return true;
		return false;
	}
	//for clearfix class;
	$scope.indexDivByThree = function (index) {
		if((index+1) % 3 == 0 )
			return true;
		else return false;
	}

	$scope.lessPost = function () {
		if($scope.count<=25)
			return true;
		return false;
	}

	$scope.GetDate = function (date) {
		var d = new Date(date);
      return d;
	}
	window.fbAsyncInit = function() {
	FB.init({
		//facebook app id
	  appId      : '494795677343992',
	  cookie     : true,  // enable cookies to allow the server to access 
	                      // the session
	  xfbml      : true,  // parse social plugins on this page
	  version    : 'v2.0', // use version 2.0
	  status     : true
	});

	FB.Event.subscribe('auth.authResponseChange', function(response) {
	     if (response.status === 'connected') 
	     {
	     	console.log(response);
	        $scope.access_token = response.authResponse.accessToken;
	        $scope.show = true;
	        $scope.$apply();
	     }   
	     else if (response.status === 'not_authorized') 
	    {
	        console.log('logged In fail');
	    } else
	    {
	        //UNKNOWN ERROR. Logged Out
	        $scope.access_token = '';
	        $scope.show = false;
	        console.log('logged In failed');
	    }
	});
	FB.Event.subscribe('auth.login', function(response) {
	  console.log(response);
	});
	};
	$scope.findPage = function (type) {
		var l = Ladda.create(document.getElementById('mainBtn'));
		l1 = Ladda.create(document.getElementById('prevBtn'));
		l2 = Ladda.create(document.getElementById('nextBtn'));
		l.start();
		l1.start();
		l2.start();
		$scope.message = '';
		$scope.qdata=[];
		if(type=='fresh'){
			$scope.countDirection = true;
			$scope.searching = false;
			$scope.count = 0;
			url = "https://graph.facebook.com/"+$scope.page_name+"/posts/?access_token="+$scope.access_token;
		}
		if(type =='next'){
			$scope.countDirection = true;
			url = $scope.paging.next;
		}
		if(type =='prev'){
			$scope.countDirection = false;
			url = $scope.paging.previous;
		}
		$.ajax({
		url: url,
		type: "GET",
		success : function (data) {
			console.log(data);
			search = data.data;
			if(search.length==0){
				$scope.message = 'No posts available to search';
			}
			console.log($scope.search_string);
			if($scope.search_string == undefined ||$scope.search_string == ' '){
				$scope.message = 'wrong query';
				return;
			}
			$scope.searching = true;
			for (var i = 0; i < search.length; i++) {
				if($scope.countDirection)
					$scope.count++;
				else
					$scope.count--;
				console.log(search[i].message);
				if(search[i].message!==undefined){
					if(search[i].message.toLowerCase().search($scope.search_string.toLowerCase())!=-1){
						$scope.qdata.push(search[i]);
					}else if(search[i].name!==undefined){
						if(search[i].name.toLowerCase().search($scope.search_string.toLowerCase())!=-1){
							$scope.qdata.push(search[i]);
						}	
					}
				}else if(search[i].description!==undefined){
					if(search[i].description.toLowerCase().search($scope.search_string.toLowerCase())!=-1){
						$scope.qdata.push(search[i]);
					}
				}
			};
			if(data.paging !==undefined){
				$scope.paging = data.paging;
				$scope.next = true;	
				$scope.prev = true;
			} 
			if($scope.qdata.length==0){
				$scope.findPage('next');
			}else{
				l.stop();
				l1.stop();
				l2.stop();
				$scope.message = '';
			}
			console.log($scope.qdata);
			// if(data.paging !==undefined){
			// 	$scope.paging = data.paging;
			// 	$scope.next = true;	
			// 	$scope.prev = true;
			// } 
			console.log($scope.paging);
{'fraction_non_alphanumeric': 0.1796786030621283, 'fraction_numerical': 0.009869669745666203, 'mean_word_length': 2.81099324975892, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '598812', 'n_tokens_mistral': 3210, 'n_tokens_neox': 2732, 'n_words': 477}