public ArrayList<Integer> getNumberOfPagesInSelectedChapters(Term termRoot, ArrayList<Integer> selectedChapters) {
		PageRange range = termRoot.getExtendedRange();
		ArrayList<Integer> ranges = new ArrayList<>(range.getRanges());
		ArrayList<Integer> acceptablePages = new ArrayList<>();
		for(int i = 0;i < selectedChapters.size();i++){
			int start = toc.getChapters().get(selectedChapters.get(i)).getStart();
			int end = toc.getChapters().get(selectedChapters.get(i)).getEnd();
			for(int j = 0;j < ranges.size();j++){
				if(ranges.get(j) <= end && ranges.get(j) >= start){
					acceptablePages.add(ranges.get(j));
				}
			}
		}
		if(selectedChapters.size() != 0){
			System.out.println(termRoot.getTerm() + ": in chapter "+selectedChapters.get(0));
			System.out.println(acceptablePages.toString());
			return acceptablePages;
		}
		else {
			return ranges;
		}
	}