Like this (assuming that you already have a JSESSIONID field or something like user that you can use for that):
| makeresults
| addinfo
| foreach info_*_time [ eval <<FIELD>> = strftime(<<FIELD>>, "%m/%d/%Y:%H:%M:%S") ]
| map search="|gentimes increment=1m start=$info_min_time$ end=$info_max_time$"
| streamstats count AS _serial
| eval JESSIONID=if(_serial<=30, "1", "2")
| streamstats count AS _serial BY JESSIONID
| eval URL=case(_serial<5 OR _serial>25, "ignore" . _serial, _serial=="5", "start", _serial=="25", "end", true(), "include" . _serial)
| rename starttime AS _time
| table _time JESSIONID URL
| sort 0 -_time
| rename COMMENT AS "Everything above generates sample event data; everything below is your solution"
| streamstats count(eval(match(URL, "end"))) AS endID BY JESSIONID
| reverse
| streamstats count(eval(match(URL, "start"))) AS startID BY JESSIONID
| where endID==startID
| stats dc(URL) count(URL) BY JESSIONID
... View more