"but I was hoping I could develop something simple with php."
So you want to build your own log analyzer? :-)
All webtrends does is read the logfile and find out which URL's each remote_addr visited, and then it sticks all those URL's together by linking the URL to the previous HTTP_REFERER.
Not a complex trick, but a lot of work.