//category-name1 заранее не известно
preg_match( "#(?<=/category/)[a-zA-Z0-9-_]+#", 'http://example/category/category-name1/pagename.html', $matches );
array(1) {
[0]=>
string(8) "pagename"
}
echo basename('http://example/category/category-name1/pagename.html', '.html');